Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/native-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
CTEST_CONFIGURATION_TYPE: ${{ matrix.config }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -123,6 +124,32 @@ jobs:
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\cpp_test.ps1 $pwd\build\${{ matrix.config }} $pwd\local\${{ matrix.config }}

- name: Start PostgreSQL
# For now, we only test on x64-windows. As of 2026-10-02, windows-latest
# ships with PostgreSQL but windows-11-arm does not. The code here is
# copied from java.yml just to be uniform.
if: matrix.arch == 'x64'
run: |
"root" | Set-Content "$env:RUNNER_TEMP\postgres_password"
& "$env:PGBIN\initdb.exe" `
--pgdata="$env:RUNNER_TEMP\pgdata" `
--username postgres `
--pwfile="$env:RUNNER_TEMP\postgres_password" `
--auth="scram-sha-256" `
--encoding="UTF-8" `
--locale="en_US.UTF-8" `
--no-instructions
if (-not $?) { throw "Failed to initialize PostgreSQL" }
& "$env:PGBIN\pg_ctl.exe" start --pgdata="$env:RUNNER_TEMP\pgdata"
if (-not $?) { throw "Failed to start PostgreSQL" }
- name: Test Driver PostgreSQL
if: matrix.arch == 'x64'
env:
BUILD_ALL: "0"
BUILD_DRIVER_POSTGRESQL: "1"
ADBC_POSTGRESQL_TEST_URI: "postgresql://postgres:root@localhost:5432/postgres"
run: .\ci\scripts\cpp_test.ps1 $pwd\build\${{ matrix.config }} $pwd\local\${{ matrix.config }}

- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
check-latest: true
Expand Down
30 changes: 21 additions & 9 deletions .github/workflows/native-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,12 @@ jobs:
# Force bundled gtest
mamba uninstall gtest

- name: Build Driver Manager
- name: Build Drivers
env:
BUILD_ALL: "0"
BUILD_DRIVER_MANAGER: "1"
BUILD_DRIVER_MANAGER_USER_CONFIG_TEST: "1"
run: .\ci\scripts\cpp_build.ps1 $pwd $pwd\build
- name: Build Driver PostgreSQL
env:
BUILD_ALL: "0"
BUILD_DRIVER_POSTGRESQL: "1"
run: .\ci\scripts\cpp_build.ps1 $pwd $pwd\build
- name: Build Driver SQLite
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\cpp_build.ps1 $pwd $pwd\build
- name: Test Driver Manager
Expand All @@ -173,6 +165,26 @@ jobs:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
run: .\ci\scripts\cpp_test.ps1 $pwd\build
- name: Start PostgreSQL
run: |
"root" | Set-Content "$env:RUNNER_TEMP\postgres_password"
& "$env:PGBIN\initdb.exe" `
--pgdata="$env:RUNNER_TEMP\pgdata" `
--username postgres `
--pwfile="$env:RUNNER_TEMP\postgres_password" `
--auth="scram-sha-256" `
--encoding="UTF-8" `
--locale="en_US.UTF-8" `
--no-instructions
if (-not $?) { throw "Failed to initialize PostgreSQL" }
& "$env:PGBIN\pg_ctl.exe" start --pgdata="$env:RUNNER_TEMP\pgdata"
if (-not $?) { throw "Failed to start PostgreSQL" }
- name: Test Driver PostgreSQL
env:
BUILD_ALL: "0"
BUILD_DRIVER_POSTGRESQL: "1"
ADBC_POSTGRESQL_TEST_URI: "postgresql://postgres:root@localhost:5432/postgres"
run: .\ci\scripts\cpp_test.ps1 $pwd\build

# ------------------------------------------------------------
# Go build
Expand Down
5 changes: 2 additions & 3 deletions c/driver/postgresql/copy/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,9 @@ class PostgresCopyNumericFieldWriter : public PostgresCopyFieldWriter {
int16_t dscale =
static_cast<int16_t>((std::max)(0, parts.effective_scale - trailing_zeros));

// Optimize: remove trailing zero digit groups from fractional part
// Optimize: remove trailing zero digit groups
int n_int_digit_groups = int_digits.size();
while (static_cast<int>(all_digits.size()) > n_int_digit_groups &&
all_digits.back() == 0) {
while (!all_digits.empty() && all_digits.back() == 0) {
all_digits.pop_back();
}

Expand Down
36 changes: 19 additions & 17 deletions c/driver/postgresql/postgresql_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ TEST_F(PostgresConnectionTest, GetInfoMetadata) {
}
case ADBC_INFO_VENDOR_VERSION: {
ArrowStringView val = ArrowArrayViewGetStringUnsafe(str_child, offset);
#ifdef __WIN32
// Fall back to a simpler version regex. This only really impacts WIN32/MSVC but
// this is slightly more correct/portable.
#if GTEST_USES_SIMPLE_RE
const char* pater = "\\d\\d\\d\\d\\d\\d";
#else
const char* pater = "[0-9]{6}";
Expand Down Expand Up @@ -2947,49 +2949,49 @@ static std::initializer_list<TypeTestCase> kIntervalTypeCases = {
"INTERVAL",
"'P-1Y2M42DT1H1M1S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(-10, 42, (1L * 60 * 60 + 60L + 1L) * 1'000'000'000),
MonthDayNano(-10, 42, (1LL * 60 * 60 + 60LL + 1LL) * 1'000'000'000),
},
{
"INTERVAL2",
"INTERVAL",
"'P0Y0M0DT0H0M0.1S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 100L * 1'000'000),
MonthDayNano(0, 0, 100LL * 1'000'000),
},
{
"INTERVAL3",
"INTERVAL",
"'P0Y0M0DT0H0M0.01S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 10L * 1'000'000),
MonthDayNano(0, 0, 10LL * 1'000'000),
},
{
"INTERVAL4",
"INTERVAL",
"'P0Y0M0DT0H0M0.001S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 1L * 1'000'000),
MonthDayNano(0, 0, 1LL * 1'000'000),
},
{
"INTERVAL5",
"INTERVAL",
"'P0Y0M0DT0H0M0.0001S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 100'000L),
MonthDayNano(0, 0, 100'000LL),
},
{
"INTERVAL6",
"INTERVAL",
"'P0Y0M0DT0H0M0.00001S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 10'000L),
MonthDayNano(0, 0, 10'000LL),
},
{
"INTERVAL7",
"INTERVAL",
"'P0Y0M0DT0H0M0.000001S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 1'000L),
MonthDayNano(0, 0, 1'000LL),
},
{
"INTERVAL_YEAR",
Expand Down Expand Up @@ -3017,21 +3019,21 @@ static std::initializer_list<TypeTestCase> kIntervalTypeCases = {
"INTERVAL HOUR",
"'12H'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 12L * 60 * 60 * 1'000'000'000),
MonthDayNano(0, 0, 12LL * 60 * 60 * 1'000'000'000),
},
{
"INTERVAL_MINUTE",
"INTERVAL MINUTE",
"'P0Y0M0DT0H-5M0S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, -5L * 60 * 1'000'000'000),
MonthDayNano(0, 0, -5LL * 60 * 1'000'000'000),
},
{
"INTERVAL_SECOND",
"INTERVAL SECOND",
"'P0Y0M0DT0H0M42S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 42L * 1'000'000'000),
MonthDayNano(0, 0, 42LL * 1'000'000'000),
},
{
"INTERVAL_YEAR_TO_MONTH",
Expand All @@ -3045,42 +3047,42 @@ static std::initializer_list<TypeTestCase> kIntervalTypeCases = {
"INTERVAL DAY TO HOUR",
"'P0Y0M1DT-2H0M0S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 1, -2L * 60 * 60 * 1'000'000'000),
MonthDayNano(0, 1, -2LL * 60 * 60 * 1'000'000'000),
},
{
"INTERVAL_DAY_TO_MINUTE",
"INTERVAL DAY TO MINUTE",
"'P0Y0M1DT-2H1M0S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 1, (-2L * 60 + 1L) * 60 * 1'000'000'000),
MonthDayNano(0, 1, (-2LL * 60 + 1LL) * 60 * 1'000'000'000),
},
{
"INTERVAL_DAY_TO_SECOND",
"INTERVAL DAY TO SECOND",
"'P0Y0M1DT-2H1M-1S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 1, ((-2L * 60 + 1L) * 60 - 1L) * 1'000'000'000),
MonthDayNano(0, 1, ((-2LL * 60 + 1LL) * 60 - 1LL) * 1'000'000'000),
},
{
"INTERVAL_HOUR_TO_MINUTE",
"INTERVAL HOUR TO MINUTE",
"'P0Y0M0DT-2H1M0S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, (-2L * 60 + 1L) * 60 * 1'000'000'000),
MonthDayNano(0, 0, (-2LL * 60 + 1LL) * 60 * 1'000'000'000),
},
{
"INTERVAL_HOUR_TO_SECOND",
"INTERVAL HOUR TO SECOND",
"'P0Y0M0DT-2H1M-1S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, ((-2L * 60 + 1L) * 60 - 1L) * 1'000'000'000),
MonthDayNano(0, 0, ((-2LL * 60 + 1LL) * 60 - 1LL) * 1'000'000'000),
},
{
"INTERVAL_MINUTE_TO_SECOND",
"INTERVAL MINUTE TO SECOND",
"'P0Y0M0DT0H1M-1S'",
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO,
MonthDayNano(0, 0, 59L * 1'000'000'000),
MonthDayNano(0, 0, 59LL * 1'000'000'000),
},
};
static std::initializer_list<TypeTestCase> kTimeTypeCases = {
Expand Down
Loading