Copilot commented on code in PR #49695:
URL: https://github.com/apache/arrow/pull/49695#discussion_r3285560272


##########
compose.yaml:
##########
@@ -517,6 +535,8 @@ services:
       ARROW_S3: "OFF"
       ARROW_SUBSTRAIT: "OFF"
     # Register ODBC before running tests
+    depends_on:
+      - dremio

Review Comment:
   `depends_on: - dremio` doesn’t wait for the Dremio healthcheck to pass; it 
only ensures start order. For reliability, use the `depends_on: dremio: { 
condition: service_healthy }` form (Compose v2) or add an explicit wait/retry 
in the test container before attempting to connect.
   



##########
cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance.sh:
##########
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+
+HOST_URL="http://localhost:9047";
+NEW_USER_URL="$HOST_URL/apiv2/bootstrap/firstuser"
+LOGIN_URL="$HOST_URL/apiv2/login"
+SQL_URL="$HOST_URL/api/v3/sql"
+
+ADMIN_USER="admin"
+ADMIN_PASSWORD="admin2025"
+
+# Wait for Dremio to be available.
+until curl -s "$NEW_USER_URL"; do
+    echo 'Waiting for Dremio to start...'
+    sleep 5
+done
+
+echo ""
+echo 'Creating admin user...'
+
+# Create new admin account.
+curl -X PUT "$NEW_USER_URL" \
+     -H "Content-Type: application/json" \
+     -d "{ \"userName\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\" }"
+
+echo ""
+echo "Created admin user."
+
+# Use admin account to login and acquire a token.
+TOKEN=$(curl -s -X POST "$LOGIN_URL" \
+     -H "Content-Type: application/json" \
+     -d "{ \"userName\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\" }" 
\
+     | grep -oP '(?<="token":")[^"]+')
+

Review Comment:
   User creation/login calls don’t fail the script on HTTP error codes (curl 
exits 0 on 4xx/5xx unless `--fail` is used), and token extraction relies on 
`grep -P` plus doesn’t validate that a token was found. This can lead to 
sending an empty/invalid Authorization header and continuing as if setup 
succeeded. Consider adding `--fail` to the curl requests and parsing/validating 
the JSON token using the existing Python dependency (or another portable JSON 
parser).



##########
.github/workflows/cpp_extra.yml:
##########
@@ -372,6 +372,10 @@ jobs:
           persist-credentials: false
           fetch-depth: 0
           submodules: recursive
+      - name: Set Up Dremio Instance
+        run: |
+          docker compose up -d dremio
+          cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance.sh
       - name: Cache Docker Volumes

Review Comment:
   `set_up_dremio_instance.sh` invokes `python3`, but the workflow 
installs/configures Python later (in the next step). Move 
`actions/setup-python` before this step (or otherwise guarantee python3 is 
available) so the job doesn’t rely on runner image defaults.



##########
compose.yaml:
##########
@@ -371,6 +372,22 @@ services:
         /arrow/ci/scripts/cpp_build.sh /arrow /build &&
         /arrow/ci/scripts/cpp_test.sh /arrow /build"
 
+  dremio:
+    platform: linux/x86_64
+    image: dremio/dremio-oss:latest
+    ports:
+      - 9047:9047  # REST API
+      - 31010:31010  # JDBC/ODBC
+      - 32010:32010
+    container_name: dremio_container
+    environment:
+    - DREMIO_JAVA_SERVER_EXTRA_OPTS=-Dsaffron.default.charset=UTF-8 
-Dsaffron.default.nationalcharset=UTF-8 
-Dsaffron.default.collation.name=UTF-8$$en_US

Review Comment:
   `environment:` is followed by an unindented list item, which makes the YAML 
invalid (list items must be indented under the key). Indent the `- 
DREMIO_JAVA_SERVER_EXTRA_OPTS=...` entry under `environment:` (and consider 
quoting it since it contains spaces and `$` escaping).
   



##########
compose.yaml:
##########
@@ -371,6 +372,22 @@ services:
         /arrow/ci/scripts/cpp_build.sh /arrow /build &&
         /arrow/ci/scripts/cpp_test.sh /arrow /build"
 
+  dremio:
+    platform: linux/x86_64
+    image: dremio/dremio-oss:latest

Review Comment:
   Using the mutable `dremio/dremio-oss:latest` tag makes CI non-reproducible 
and can introduce unexpected breakages when the upstream image changes. Pin the 
image to a specific Dremio OSS version (optionally with a digest) to keep 
builds deterministic.
   



##########
cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance.sh:
##########
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+
+HOST_URL="http://localhost:9047";
+NEW_USER_URL="$HOST_URL/apiv2/bootstrap/firstuser"
+LOGIN_URL="$HOST_URL/apiv2/login"
+SQL_URL="$HOST_URL/api/v3/sql"
+
+ADMIN_USER="admin"
+ADMIN_PASSWORD="admin2025"
+
+# Wait for Dremio to be available.
+until curl -s "$NEW_USER_URL"; do
+    echo 'Waiting for Dremio to start...'
+    sleep 5

Review Comment:
   The wait loop uses `curl -s` without `--fail` and has no timeout, so it may 
exit early on non-2xx responses or hang indefinitely if Dremio never becomes 
ready. Consider using `curl --fail --silent --show-error` (or checking the HTTP 
status) and adding a bounded retry/timeout.
   



##########
compose.yaml:
##########
@@ -509,6 +526,7 @@ services:
       ARROW_DEPENDENCY_SOURCE: BUNDLED
       ARROW_DEPENDENCY_USE_SHARED: "OFF"
       ARROW_FLIGHT_SQL_ODBC: "ON"
+      ARROW_FLIGHT_SQL_ODBC_CONN: "driver={Apache Arrow Flight SQL ODBC 
Driver};HOST=dremio_container;port=32010;pwd=admin2025;uid=admin;useEncryption=false;UseWideChar=true;"

Review Comment:
   The connection string uses `HOST=dremio_container`, which is tied to the 
hard-coded `container_name`. If `container_name` is removed (recommended) or if 
compose generates different container names, this will break name resolution. 
Prefer using the stable service name `dremio` in the connection string instead.
   



##########
compose.yaml:
##########
@@ -371,6 +372,22 @@ services:
         /arrow/ci/scripts/cpp_build.sh /arrow /build &&
         /arrow/ci/scripts/cpp_test.sh /arrow /build"
 
+  dremio:
+    platform: linux/x86_64
+    image: dremio/dremio-oss:latest
+    ports:
+      - 9047:9047  # REST API
+      - 31010:31010  # JDBC/ODBC
+      - 32010:32010
+    container_name: dremio_container

Review Comment:
   `container_name: dremio_container` is the only hard-coded container name in 
this compose file and can cause name collisions when running multiple compose 
projects (or concurrent runs) on the same host. Prefer omitting 
`container_name` and using the service name (`dremio`) for intra-compose DNS.
   



-- 
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