You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/04/07 18:55:19 UTC

[arrow] branch master updated: ARROW-16128: [C++][FlightRPC] Fix Flight SQL static build on Windows

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

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


The following commit(s) were added to refs/heads/master by this push:
     new b7f7bad55a ARROW-16128: [C++][FlightRPC] Fix Flight SQL static build on Windows
b7f7bad55a is described below

commit b7f7bad55a172b416c99640003a2e0eb9414c6c9
Author: Alex McRae <al...@dremio.com>
AuthorDate: Thu Apr 7 14:55:04 2022 -0400

    ARROW-16128: [C++][FlightRPC] Fix Flight SQL static build on Windows
    
    * Removes non-std initializer list
    * Sets ARROW_FLIGHT_STATIC to match ARROW_STATIC when ARROW_BUILD_STATIC
      and WIN32
    * Updates the documentation arrow staticly linking on windows to include
      the ARROW_FLIGHT_STATIC definition, including an example
    
    The goal of this is to allow flightsql to build easily on Windows.
    
    Closes #12789 from mcraealex-bq/master
    
    Lead-authored-by: Alex McRae <al...@dremio.com>
    Co-authored-by: David Li <li...@gmail.com>
    Signed-off-by: David Li <li...@gmail.com>
---
 cpp/cmake_modules/BuildUtils.cmake     |  1 +
 cpp/src/arrow/flight/sql/client.cc     |  4 ++--
 docs/source/developers/cpp/windows.rst | 14 ++++++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake
index 2bcaed43e5..174b1c515a 100644
--- a/cpp/cmake_modules/BuildUtils.cmake
+++ b/cpp/cmake_modules/BuildUtils.cmake
@@ -445,6 +445,7 @@ function(ADD_ARROW_LIB LIB_NAME)
 
     if(ARROW_BUILD_STATIC AND WIN32)
       target_compile_definitions(${LIB_NAME}_static PUBLIC ARROW_STATIC)
+      target_compile_definitions(${LIB_NAME}_static PUBLIC ARROW_FLIGHT_STATIC)
     endif()
 
     set_target_properties(${LIB_NAME}_static
diff --git a/cpp/src/arrow/flight/sql/client.cc b/cpp/src/arrow/flight/sql/client.cc
index b86cb8008e..89cfb3aad0 100644
--- a/cpp/src/arrow/flight/sql/client.cc
+++ b/cpp/src/arrow/flight/sql/client.cc
@@ -369,8 +369,8 @@ arrow::Result<int64_t> PreparedStatement::ExecuteUpdate() {
   } else {
     const std::shared_ptr<Schema> schema = arrow::schema({});
     ARROW_RETURN_NOT_OK(client_->DoPut(options_, descriptor, schema, &writer, &reader));
-    const auto& record_batch =
-        arrow::RecordBatch::Make(schema, 0, (std::vector<std::shared_ptr<Array>>){});
+    const ArrayVector columns;
+    const auto& record_batch = arrow::RecordBatch::Make(schema, 0, columns);
     ARROW_RETURN_NOT_OK(writer->WriteRecordBatch(*record_batch));
   }
 
diff --git a/docs/source/developers/cpp/windows.rst b/docs/source/developers/cpp/windows.rst
index ad3f47749b..84ba000cb5 100644
--- a/docs/source/developers/cpp/windows.rst
+++ b/docs/source/developers/cpp/windows.rst
@@ -362,6 +362,20 @@ suppress dllimport/dllexport marking of symbols. Projects that statically link
 against Arrow on Windows additionally need this definition. The Unix builds do
 not use the macro.
 
+In addition if using ``-DARROW_FLIGHT=ON``, ``ARROW_FLIGHT_STATIC`` needs to
+be defined.
+
+.. code-block:: cmake
+
+   project(MyExample)
+
+   find_package(Arrow REQUIRED)
+
+   add_executable(my_example my_example.cc)
+   target_link_libraries(my_example PRIVATE arrow_static arrow_flight_static)
+
+   target_compile_definitions(my_example PUBLIC ARROW_STATIC ARROW_FLIGHT_STATIC)
+
 Downloading the Timezone Database
 =================================