Skip to content

Commit 7b6d340

Browse files
committed
Address feedback
- Move `dremio` to `compose.yaml` at project root - Move shebang to first line - add `set_up_dremio_instance.sh` to pre-commit hook - Fix `SQL_QUERY` variable format
1 parent e09e2d1 commit 7b6d340

5 files changed

Lines changed: 40 additions & 45 deletions

File tree

.github/workflows/cpp_extra.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ jobs:
373373
run: docker network create odbc_net
374374
- name: Set Up Dremio Instance
375375
run: |
376-
docker compose -f cpp/src/arrow/flight/sql/odbc/tests/dremio/docker-compose.yml up -d
376+
docker compose up -d dremio
377377
cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance.sh
378378
- name: Cache Docker Volumes
379379
uses: actions/cache@v5

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ repos:
351351
?^cpp/examples/minimal_build/run\.sh$|
352352
?^cpp/examples/tutorial_examples/run\.sh$|
353353
?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc\.sh$|
354+
?^cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance\.sh$|
354355
?^dev/release/05-binary-upload\.sh$|
355356
?^dev/release/08-binary-verify\.sh$|
356357
?^dev/release/binary-recover\.sh$|

compose.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ x-hierarchy:
139139
- fedora-python
140140
- fedora-r-clang
141141
- python-sdist
142+
- dremio
142143
- ubuntu-cpp:
143144
- ubuntu-cpp-static
144145
- ubuntu-c-glib:
@@ -376,6 +377,24 @@ services:
376377
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
377378
/arrow/ci/scripts/cpp_test.sh /arrow /build"
378379

380+
dremio:
381+
platform: linux/x86_64
382+
image: dremio/dremio-oss:latest
383+
ports:
384+
- 9047:9047 # REST API
385+
- 31010:31010 # JDBC/ODBC
386+
- 32010:32010
387+
container_name: dremio_container
388+
environment:
389+
- DREMIO_JAVA_SERVER_EXTRA_OPTS=-Dsaffron.default.charset=UTF-8 -Dsaffron.default.nationalcharset=UTF-8 -Dsaffron.default.collation.name=UTF-8$$en_US
390+
healthcheck:
391+
test: curl --fail http://localhost:9047 || exit 1
392+
interval: 10s
393+
timeout: 5s
394+
retries: 30
395+
networks:
396+
- odbc_net
397+
379398
ubuntu-cpp: &ubuntu-cpp-base
380399
# Usage:
381400
# docker compose build ubuntu-cpp

cpp/src/arrow/flight/sql/odbc/tests/dremio/docker-compose.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/bash
2+
#
13
# Licensed to the Apache Software Foundation (ASF) under one
24
# or more contributor license agreements. See the NOTICE file
35
# distributed with this work for additional information
@@ -15,7 +17,6 @@
1517
# specific language governing permissions and limitations
1618
# under the License.
1719

18-
#!/bin/bash
1920
set -e
2021

2122
HOST_URL="http://localhost:9047"
@@ -49,16 +50,29 @@ TOKEN=$(curl -s -X POST "$LOGIN_URL" \
4950
-d "{ \"userName\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\" }" \
5051
| grep -oP '(?<="token":")[^"]+')
5152

52-
SQL_QUERY="Create Table \$scratch.ODBCTest As SELECT CAST(2147483647 AS INTEGER) AS sinteger_max, CAST(9223372036854775807 AS BIGINT) AS sbigint_max, CAST(999999999 AS DECIMAL(38,0)) AS decimal_positive, CAST(3.40282347E38 AS FLOAT) AS float_max, CAST(1.7976931348623157E308 AS DOUBLE) AS double_max, CAST(true AS BOOLEAN) AS bit_true, CAST(DATE '9999-12-31' AS DATE) AS date_max, CAST(TIME '23:59:59' AS TIME) AS time_max, CAST(TIMESTAMP '9999-12-31 23:59:59' AS TIMESTAMP) AS timestamp_max;"
53-
ESCAPED_QUERY=$(printf '%s' "$SQL_QUERY" | sed 's/"/\\"/g')
54-
53+
SQL_QUERY="
54+
Create Table \$scratch.ODBCTest As
55+
SELECT CAST(2147483647 AS INTEGER) AS sinteger_max,
56+
CAST(9223372036854775807 AS BIGINT) AS sbigint_max,
57+
CAST(999999999 AS DECIMAL(38,0)) AS decimal_positive,
58+
CAST(3.40282347E38 AS FLOAT) AS float_max,
59+
CAST(1.7976931348623157E308 AS DOUBLE) AS double_max,
60+
CAST(true AS BOOLEAN) AS bit_true,
61+
CAST(DATE '9999-12-31' AS DATE) AS date_max,
62+
CAST(TIME '23:59:59' AS TIME) AS time_max,
63+
CAST(TIMESTAMP '9999-12-31 23:59:59' AS TIMESTAMP) AS timestamp_max;
64+
"
5565
echo "Creating \$scratch.ODBCTest table."
5666

5767
# Create a new table by sending a SQL query.
5868
curl -i -X POST "$SQL_URL" \
5969
-H "Authorization: _dremio$TOKEN" \
6070
-H "Content-Type: application/json" \
61-
-d "{\"sql\": \"$ESCAPED_QUERY\"}"
71+
-d "$(python3 - <<'EOF'
72+
import json
73+
print(json.dumps({"sql": """$SQL_QUERY"""}))
74+
EOF
75+
)"
6276

6377
echo ""
6478
echo "Finished setting up dremio docker instance."

0 commit comments

Comments
 (0)