kou commented on code in PR #49564:
URL: https://github.com/apache/arrow/pull/49564#discussion_r2992111642


##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/system_dsn.cc:
##########
@@ -23,6 +23,29 @@
 #include <boost/algorithm/string/predicate.hpp>
 #include <sstream>
 
+#include "arrow/flight/sql/odbc/odbc_impl/encoding_utils.h"
+
+#ifdef __linux__
+// Linux driver manager uses utf16string
+#  define CONVERT_UTF8_TO_SQLWCHAR_OR_RETURN(wvar, var)       \
+    auto wvar##_result = arrow::util::UTF8StringToUTF16(var); \
+    if (!wvar##_result.status().ok()) {                       \
+      PostArrowUtilError(wvar##_result.status());             \
+      return false;                                           \
+    }                                                         \
+    std::u16string wvar = wvar##_result.ValueOrDie();
+
+#else
+// Windows and macOS
+#  define CONVERT_UTF8_TO_SQLWCHAR_OR_RETURN(wvar, var)      \
+    auto wvar##_result = arrow::util::UTF8ToWideString(var); \
+    if (!wvar##_result.status().ok()) {                      \
+      PostArrowUtilError(wvar##_result.status());            \
+      return false;                                          \
+    }                                                        \
+    std::wstring wvar = wvar##_result.ValueOrDie();
+#endif  // __linux__

Review Comment:
   Can we use function instead of macro for easy to debug? We can't use step 
execution in debugger with macro.



##########
cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh:
##########
@@ -40,7 +40,16 @@ if [ ! -f "$ODBC_64BIT" ]; then
   exit 1
 fi
 
-USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini"
+case "$(uname)" in
+  Linux)
+    USER_ODBCINST_FILE="/etc/odbcinst.ini"
+    ;;
+  *)
+    # macOS
+    USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini"
+    ;;
+esac
+
 DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver"
 
 mkdir -p "$HOME"/Library/ODBC

Review Comment:
   Should we update this too?



##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.cc:
##########
@@ -28,6 +26,10 @@
 #include "arrow/flight/sql/odbc/odbc_impl/spi/statement.h"
 #include "arrow/flight/sql/odbc/odbc_impl/type_utilities.h"
 
+// Include ODBC headers after arrow headers to avoid conflicts
+#include <sql.h>
+#include <sqlext.h>

Review Comment:
   Should we use `arrow/flight/sql/odbc/odbc_impl/odbc_includes.h` instead?



##########
compose.yaml:
##########
@@ -496,6 +497,43 @@ services:
     volumes: *ubuntu-volumes
     command: *cpp-command
 
+  ubuntu-cpp-odbc:
+    # Arrow Flight SQL ODBC build with BUNDLED dependencies with downloaded 
dependencies.
+    image: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cpp
+    build:
+      context: .
+      dockerfile: ci/docker/ubuntu-${UBUNTU}-cpp.dockerfile
+      cache_from:
+        - ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cpp
+      args:
+        arch: ${ARCH}
+        base: "${ARCH}/ubuntu:${UBUNTU}"
+        clang_tools: ${CLANG_TOOLS}
+        cmake: ${CMAKE}
+        gcc: ${GCC}
+        llvm: ${LLVM}
+    shm_size: *shm-size
+    cap_add:
+      - SYS_ADMIN
+    devices:
+      - "/dev/fuse:/dev/fuse"

Review Comment:
   We don't need this.
   
   ```suggestion
   ```



##########
.github/workflows/cpp_extra.yml:
##########
@@ -336,6 +336,62 @@ jobs:
           cd cpp/examples/minimal_build
           ../minimal_build.build/arrow-example
 
+  odbc-linux:
+    needs: check-labels
+    name: ODBC Linux
+    runs-on: ubuntu-latest
+    if: >-
+      needs.check-labels.outputs.force == 'true' ||
+      contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 
'CI: Extra') ||
+      contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 
'CI: Extra: C++')
+    timeout-minutes: 75
+    strategy:
+      fail-fast: false
+    env:
+      ARCH: amd64
+      ARCHERY_DEBUG: 1
+      ARROW_ENABLE_TIMING_TESTS: OFF
+      DOCKER_VOLUME_PREFIX: ".docker/"
+      UBUNTU: 24.04
+    steps:
+      - name: Checkout Arrow
+        uses: actions/checkout@v6
+        with:
+          fetch-depth: 0
+          submodules: recursive
+      - name: Cache Docker Volumes
+        uses: actions/cache@v5
+        with:
+          path: .docker
+          key: ubuntu-cpp-odbc-${{ hashFiles('cpp/**') }}
+          restore-keys: ubuntu-cpp-odbc-
+      - name: Setup Python on hosted runner
+        uses: actions/setup-python@v6
+        with:
+          python-version: 3
+      - name: Setup Archery
+        run: python3 -m pip install -e dev/archery[docker]
+      - name: Execute Docker Build
+        env:
+          ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
+          ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
+        run: |
+          # GH-40558: reduce ASLR to avoid ASAN/LSAN crashes
+          sudo sysctl -w vm.mmap_rnd_bits=28
+          source ci/scripts/util_enable_core_dumps.sh
+          archery docker run ubuntu-cpp-odbc
+      - name: Docker Push
+        if: >-
+          success() &&
+          github.event_name == 'push' &&
+          github.repository == 'apache/arrow' &&
+          github.ref_name == 'main'
+        env:
+          ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
+          ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
+        continue-on-error: true
+        run: archery docker push ubuntu-cpp-odbc

Review Comment:
   We don't need this image because we can reuse `ubuntu-cpp` image.
   
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to