Skip to content

Commit

Permalink
Fix to client, CMake build, etc. (#31)
Browse files Browse the repository at this point in the history
* Bugfix for closing prepared statements in flight_sql_client.cpp

* Updated Python to 3.12 in Dockerfiles

* CMake refactors

* Fixes
  • Loading branch information
prmoore77 authored Mar 4, 2024
1 parent 6280bfb commit 72360f2
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Install build requirements
run: |
brew install boost gflags
brew install automake boost gflags
- name: Configure Project
uses: threeal/[email protected]
Expand Down Expand Up @@ -93,6 +93,7 @@ jobs:
sudo apt-get install -y \
build-essential \
ninja-build \
automake \
cmake \
gcc \
git \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/jwt-cpp"
)

set(JWT_CPP_INCLUDE_DIR "${CMAKE_BINARY_DIR}/third_party/src/jwt_cpp_project/include")
set(JWT_CPP_INCLUDE_DIR "${CMAKE_BINARY_DIR}/third_party/jwt-cpp/include")

# --------------------------------------------------

Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.8
FROM python:3.12.2

ARG TARGETPLATFORM
ARG TARGETARCH
Expand All @@ -13,6 +13,7 @@ RUN apt-get update && \
apt-get dist-upgrade --yes && \
apt-get install -y \
build-essential \
automake \
cmake \
wget \
gcc \
Expand Down Expand Up @@ -80,11 +81,8 @@ COPY --chown=app_user:app_user ./third_party ./third_party
COPY --chown=app_user:app_user ./src ./src

# Run the CMake build (then cleanup)
RUN mkdir build && \
cd build && \
cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local && \
cmake --build . --target install && \
cd .. && \
RUN cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr/local && \
cmake --build build --target install && \
rm -rf build src third_party CMakeLists.txt

COPY --chown=app_user:app_user ./tls ./tls
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.8
FROM python:3.12.2

ARG TARGETPLATFORM
ARG TARGETARCH
Expand Down
6 changes: 4 additions & 2 deletions src/flight_sql_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ Status RunMain() {
} else if (FLAGS_command == "PreparedStatementExecute") {
ARROW_ASSIGN_OR_RAISE(auto prepared_statement,
sql_client.Prepare(call_options, FLAGS_query));
ARROW_ASSIGN_OR_RAISE(info, prepared_statement->Execute());
ARROW_ASSIGN_OR_RAISE(info, prepared_statement->Execute(call_options));
ARROW_RETURN_NOT_OK(prepared_statement->Close(call_options));
} else if (FLAGS_command == "PreparedStatementExecuteParameterBinding") {
ARROW_ASSIGN_OR_RAISE(auto prepared_statement, sql_client.Prepare({}, FLAGS_query));
auto parameter_schema = prepared_statement->parameter_schema();
Expand All @@ -194,7 +195,8 @@ Status RunMain() {
result = arrow::RecordBatch::Make(parameter_schema, 1, {int_array});

ARROW_RETURN_NOT_OK(prepared_statement->SetParameters(result));
ARROW_ASSIGN_OR_RAISE(info, prepared_statement->Execute());
ARROW_ASSIGN_OR_RAISE(info, prepared_statement->Execute(call_options));
ARROW_RETURN_NOT_OK(prepared_statement->Close(call_options));
} else if (FLAGS_command == "GetDbSchemas") {
ARROW_ASSIGN_OR_RAISE(
info, sql_client.GetDbSchemas(call_options, &FLAGS_catalog, &FLAGS_schema));
Expand Down
5 changes: 4 additions & 1 deletion third_party/JWTCPP_CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ ExternalProject_Add(
PREFIX ${CMAKE_BINARY_DIR}/third_party
GIT_REPOSITORY https://github.com/Thalhammer/jwt-cpp.git
GIT_TAG v0.7.0
BUILD_COMMAND "" # This is a header only library
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/third_party/jwt-cpp
-DJWT_BUILD_EXAMPLES=OFF
BUILD_COMMAND "" # This is a header only library
)
2 changes: 1 addition & 1 deletion third_party/SQLite_CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include(ExternalProject)
# Download and configure SQLite during the CMake configuration step
ExternalProject_Add(
sqlite_project
URL "https://sqlite.org/2024/sqlite-autoconf-3450000.tar.gz"
URL "https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz"
PREFIX "${CMAKE_BINARY_DIR}/third_party/sqlite"
CONFIGURE_COMMAND ../sqlite_project/configure "CFLAGS=-DSQLITE_ENABLE_COLUMN_METADATA=1"
BUILD_COMMAND make
Expand Down

0 comments on commit 72360f2

Please sign in to comment.