This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 5b01ed2  ci: 0.4.0 release fixes (#662)
5b01ed2 is described below

commit 5b01ed26bfc5044149bd33fd350d0f4cc6006f55
Author: David Li <[email protected]>
AuthorDate: Mon May 8 14:33:27 2023 -0400

    ci: 0.4.0 release fixes (#662)
    
    - skip Snowflake wheel on Linux/aarch64 too
    - fix how we skip the Snowflake wheel to not skip all wheels
    - fix compiler warning in PostgreSQL driver
    - pin arrow-c-glib since red-arrow 12 came out but conda-forge does not
    yet have arrow-c-glib 12
    
    Fixes #660.
    Fixes #661.
    Fixes #663.
    
    ---------
    
    Co-authored-by: Sutou Kouhei <[email protected]>
---
 c/driver/postgresql/postgres_copy_reader.h |  6 ++++--
 ci/scripts/glib_test.sh                    | 21 +++++++++++----------
 ci/scripts/python_util.sh                  | 11 +++++++++++
 ci/scripts/python_wheel_unix_build.sh      | 10 +++++++---
 glib/Gemfile                               | 16 +++++++++++++++-
 ruby/Gemfile                               |  1 -
 ruby/red-adbc.gemspec                      |  8 +++++++-
 7 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/c/driver/postgresql/postgres_copy_reader.h 
b/c/driver/postgresql/postgres_copy_reader.h
index c92e8fa..6e8f8db 100644
--- a/c/driver/postgresql/postgres_copy_reader.h
+++ b/c/driver/postgresql/postgres_copy_reader.h
@@ -31,8 +31,10 @@
 
 namespace adbcpq {
 
-static int8_t kPgCopyBinarySignature[] = {'P',  'G',    'C',  'O',  'P', 'Y',
-                                          '\n', '\377', '\r', '\n', '\0'};
+// "PGCOPY\n\377\r\n\0"
+static int8_t kPgCopyBinarySignature[] = {0x50, 0x47, 0x43, 0x4F,
+                                          0x50, 0x59, 0x0A, 
static_cast<int8_t>(0xFF),
+                                          0x0D, 0x0A, 0x00};
 
 // Read a value from the buffer without checking the buffer size. Advances
 // the cursor of data and reduces its size by sizeof(T).
diff --git a/ci/scripts/glib_test.sh b/ci/scripts/glib_test.sh
index b65c2de..ad29d47 100755
--- a/ci/scripts/glib_test.sh
+++ b/ci/scripts/glib_test.sh
@@ -61,6 +61,12 @@ test_subproject() {
                --with-cppflags=-D_LIBCPP_DISABLE_AVAILABILITY
     fi
 
+    # Install consistent version of red-arrow for given arrow-glib
+    local -r arrow_glib_version=$(pkg-config --modversion arrow-glib | sed -e 
's/-SNAPSHOT$//g' || :)
+    if [ -n "${arrow_glib_version}" ]; then
+        export RED_ARROW_VERSION="<= ${arrow_glib_version}"
+    fi
+
     bundle config set --local path 'vendor/bundle'
     bundle install
     bundle exec \
@@ -74,16 +80,11 @@ test_subproject() {
         gem_flags='-- --with-cflags="-D_LIBCPP_DISABLE_AVAILABILITY" 
--with-cppflags="-D_LIBCPP_DISABLE_AVAILABILITY"'
     fi
 
-    # Install consistent version of red-arrow for given arrow-glib
-    local -r arrow_glib_version=$(pkg-config --modversion arrow-glib | sed -e 
's/-SNAPSHOT$//g' || :)
-    if [ -n "${arrow_glib_version}" ]; then
-        gem install \
-            --install-dir "${build_dir}/gems" \
-            --version ${arrow_glib_version} \
-            red-arrow \
-            -- ${gem_flags}
-    fi
-    gem install --install-dir "${build_dir}/gems" pkg/*.gem -- ${gem_flags}
+    gem install \
+        --install-dir "${build_dir}/gems" \
+        pkg/*.gem \
+        -- \
+        ${gem_flags}
     popd
 }
 
diff --git a/ci/scripts/python_util.sh b/ci/scripts/python_util.sh
index aceb2cc..56d1b8e 100644
--- a/ci/scripts/python_util.sh
+++ b/ci/scripts/python_util.sh
@@ -42,6 +42,10 @@ function build_drivers {
         export 
ADBC_SNOWFLAKE_LIBRARY=${build_dir}/lib/libadbc_driver_snowflake.so
         export VCPKG_DEFAULT_TRIPLET="${VCPKG_ARCH}-linux-static-release"
         export CMAKE_ARGUMENTS=""
+        if [[ "${VCPKG_ARCH}" = "arm64" ]]; then
+            # Can't build Arrow v11 on non-x64 platforms
+            ADBC_DRIVER_SNOWFLAKE=OFF
+        fi
     else # macOS
         export 
ADBC_FLIGHTSQL_LIBRARY=${build_dir}/lib/libadbc_driver_flightsql.dylib
         export 
ADBC_POSTGRESQL_LIBRARY=${build_dir}/lib/libadbc_driver_postgresql.dylib
@@ -142,6 +146,13 @@ function test_packages {
     for component in ${COMPONENTS}; do
         echo "=== Testing $component ==="
 
+        if [[ "$component" = "adbc_driver_snowflake" ]] &&
+               ([[ "$(uname -m)" = "arm64" ]] ||
+                    [[ "$(uname -m)" = "aarch64" ]]); then
+            echo "=== Skipping $component on arm64 ==="
+            continue
+        fi
+
         python -c "
 import $component
 import $component.dbapi
diff --git a/ci/scripts/python_wheel_unix_build.sh 
b/ci/scripts/python_wheel_unix_build.sh
index 3faaf82..ee1db53 100755
--- a/ci/scripts/python_wheel_unix_build.sh
+++ b/ci/scripts/python_wheel_unix_build.sh
@@ -82,15 +82,19 @@ build_drivers "${source_dir}" "${build_dir}"
 check_visibility $ADBC_FLIGHTSQL_LIBRARY
 check_visibility $ADBC_POSTGRESQL_LIBRARY
 check_visibility $ADBC_SQLITE_LIBRARY
-check_visibility $ADBC_SNOWFLAKE_LIBRARY
+if [[ -f "$ADBC_SNOWFLAKE_LIBRARY" ]]; then
+    check_visibility $ADBC_SNOWFLAKE_LIBRARY
+else
+    echo "adbc_driver_snowflake not built"
+fi
 
 # https://github.com/pypa/pip/issues/7555
 # Get the latest pip so we have in-tree-build by default
 python -m pip install --upgrade pip auditwheel cibuildwheel delocate 
setuptools wheel
 
 for component in $COMPONENTS; do
-    if [[ $(uname) = "Darwin" ]] && [[ "${VCPKG_ARCH}" = "arm64" ]]; then
-        # XXX: can't build Snowflake driver on non-x64 platforms until 
upgraded to Arrow 12
+    if [[ "$component" = "adbc_driver_snowflake" ]] && [[ "${VCPKG_ARCH}" = 
"arm64" ]]; then
+        echo "Skipping $component on arm64"
         continue
     fi
 
diff --git a/glib/Gemfile b/glib/Gemfile
index e8f8ba3..35e4fab 100644
--- a/glib/Gemfile
+++ b/glib/Gemfile
@@ -20,5 +20,19 @@
 source "https://rubygems.org/";
 
 gem "gobject-introspection", ">= 4.0.3"
-gem "red-arrow"
+# Use the version of red-arrow based on the available arrow-glib version
+red_arrow_version = ">= 0"
+IO.pipe do |input, output|
+  begin
+    pid = spawn("pkg-config", "--modversion", "arrow-glib",
+                out: output,
+                err: File::NULL)
+    output.close
+    Process.waitpid(pid)
+    arrow_glib_version = input.read.strip.sub(/-SNAPSHOT\z/, "")
+    red_arrow_version = "<= #{arrow_glib_version}"
+  rescue SystemCallError
+  end
+end
+gem "red-arrow", red_arrow_version
 gem "test-unit"
diff --git a/ruby/Gemfile b/ruby/Gemfile
index c38075c..c58c75d 100644
--- a/ruby/Gemfile
+++ b/ruby/Gemfile
@@ -23,5 +23,4 @@ gemspec
 
 gem "bundler"
 gem "rake"
-gem "red-arrow"
 gem "test-unit"
diff --git a/ruby/red-adbc.gemspec b/ruby/red-adbc.gemspec
index d933f53..80175d1 100644
--- a/ruby/red-adbc.gemspec
+++ b/ruby/red-adbc.gemspec
@@ -52,7 +52,13 @@ Gem::Specification.new do |spec|
   spec.files += Dir.glob("lib/**/*.rb")
   spec.extensions = ["dependency-check/Rakefile"]
 
-  spec.add_runtime_dependency("red-arrow")
+  # For CI: sometimes we can't use the latest red-arrow due to
+  # conda-forge arrow-c-glib lagging behind
+  if ENV["RED_ARROW_VERSION"]
+    spec.add_runtime_dependency("red-arrow", ENV["RED_ARROW_VERSION"])
+  else
+    spec.add_runtime_dependency("red-arrow")
+  end
 
   # spec.metadata["msys2_mingw_dependencies"] = "adbc>=#{spec.version}"
 end

Reply via email to