Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] ARROW-3294: [C++][Flight] Support Flight on Windows #4209

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
77 changes: 39 additions & 38 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,47 +58,48 @@ environment:
matrix:
# NOTE: clcache seems to work best with Ninja and worst with msbuild
# (as generated by cmake)
- JOB: "Build"
GENERATOR: Ninja
CONFIGURATION: "Release"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
#- JOB: "Build"
#GENERATOR: Ninja
#CONFIGURATION: "Release"
#APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- JOB: "Toolchain"
GENERATOR: Visual Studio 14 2015 Win64
CONFIGURATION: "Release"
ARROW_BUILD_GANDIVA: "ON"
- JOB: "Static_Crt_Build"
GENERATOR: Ninja
- JOB: "Build_Debug"
GENERATOR: Ninja
CONFIGURATION: "Debug"
- JOB: "MinGW32"
MINGW_ARCH: i686
MINGW_PACKAGE_PREFIX: mingw-w64-i686
MINGW_PREFIX: c:\msys64\mingw32
MSYSTEM: MINGW32
USE_CLCACHE: false
- JOB: "MinGW64"
MINGW_ARCH: x86_64
MINGW_PACKAGE_PREFIX: mingw-w64-x86_64
MINGW_PREFIX: c:\msys64\mingw64
MSYSTEM: MINGW64
USE_CLCACHE: false
- JOB: "Rust"
TARGET: x86_64-pc-windows-msvc
USE_CLCACHE: false
- JOB: "C#"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
USE_CLCACHE: false
- JOB: "Go"
MINGW_PACKAGE_PREFIX: mingw-w64-x86_64
MINGW_PREFIX: c:\msys64\mingw64
MSYSTEM: MINGW64
USE_CLCACHE: false
GOROOT: 'c:\go112'
GOPATH: c:\gopath
GO111MODULE: on
GOTOOLDIR: '%GOROOT%\pkg\tool\windows_amd64'
PATH: '%GOPATH%\bin;%GOROOT%\bin;%PATH%'
ARROW_BUILD_FLIGHT: "ON"
#ARROW_BUILD_GANDIVA: "ON"
#- JOB: "Static_Crt_Build"
#GENERATOR: Ninja
#- JOB: "Build_Debug"
#GENERATOR: Ninja
#CONFIGURATION: "Debug"
#- JOB: "MinGW32"
#MINGW_ARCH: i686
#MINGW_PACKAGE_PREFIX: mingw-w64-i686
#MINGW_PREFIX: c:\msys64\mingw32
#MSYSTEM: MINGW32
#USE_CLCACHE: false
#- JOB: "MinGW64"
#MINGW_ARCH: x86_64
#MINGW_PACKAGE_PREFIX: mingw-w64-x86_64
#MINGW_PREFIX: c:\msys64\mingw64
#MSYSTEM: MINGW64
#USE_CLCACHE: false
#- JOB: "Rust"
#TARGET: x86_64-pc-windows-msvc
#USE_CLCACHE: false
#- JOB: "C#"
#APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
#USE_CLCACHE: false
#- JOB: "Go"
#MINGW_PACKAGE_PREFIX: mingw-w64-x86_64
#MINGW_PREFIX: c:\msys64\mingw64
#MSYSTEM: MINGW64
#USE_CLCACHE: false
#GOROOT: 'c:\go112'
#GOPATH: c:\gopath
#GO111MODULE: on
#GOTOOLDIR: '%GOROOT%\pkg\tool\windows_amd64'
#PATH: '%GOPATH%\bin;%GOROOT%\bin;%PATH%'

MSVC_DEFAULT_OPTIONS: ON
APPVEYOR_SAVE_CACHE_ON_ERROR: true
Expand Down
2 changes: 2 additions & 0 deletions ci/cpp-msvc-build-main.bat
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ cmake -G "%GENERATOR%" %CMAKE_ARGS% ^
-DARROW_VERBOSE_THIRDPARTY_BUILD=ON ^
-DARROW_CXXFLAGS="%ARROW_CXXFLAGS%" ^
-DCMAKE_CXX_FLAGS_RELEASE="/MD %CMAKE_CXX_FLAGS_RELEASE%" ^
-DARROW_FLIGHT=%ARROW_BUILD_FLIGHT% ^
-DARROW_GANDIVA=%ARROW_BUILD_GANDIVA% ^
-DARROW_PARQUET=ON ^
-DPARQUET_BUILD_EXECUTABLES=ON ^
Expand Down Expand Up @@ -93,6 +94,7 @@ set PYARROW_BUNDLE_ARROW_CPP=ON
set PYARROW_BUNDLE_BOOST=OFF
set PYARROW_WITH_STATIC_BOOST=ON
set PYARROW_WITH_PARQUET=ON
set PYARROW_WITH_FLIGHT=%ARROW_BUILD_FLIGHT%
set PYARROW_WITH_GANDIVA=%ARROW_BUILD_GANDIVA%
set PYARROW_PARALLEL=2

Expand Down
9 changes: 9 additions & 0 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,10 @@ endmacro()
if(ARROW_WITH_PROTOBUF)
resolve_dependency(Protobuf)

if(ARROW_PROTOBUF_USE_SHARED AND MSVC)
add_definitions(-DPROTOBUF_USE_DLLS)
endif()

# TODO: Don't use global includes but rather target_include_directories
include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR})

Expand Down Expand Up @@ -1750,6 +1754,8 @@ macro(build_cares)
CMAKE_ARGS ${CARES_CMAKE_ARGS}
BUILD_BYPRODUCTS "${CARES_STATIC_LIB}")

file(MAKE_DIRECTORY ${CARES_INCLUDE_DIR})

add_dependencies(toolchain cares_ep)
add_library(c-ares::cares STATIC IMPORTED)
set_target_properties(c-ares::cares
Expand Down Expand Up @@ -1877,6 +1883,9 @@ macro(build_grpc)
CMAKE_ARGS ${GRPC_CMAKE_ARGS} ${EP_LOG_OPTIONS}
DEPENDS ${grpc_dependencies})

# Work around https://gitlab.kitware.com/cmake/cmake/issues/15052
file(MAKE_DIRECTORY ${GRPC_INCLUDE_DIR})

add_library(gRPC::gpr STATIC IMPORTED)
set_target_properties(gRPC::gpr
PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GPR}"
Expand Down
20 changes: 19 additions & 1 deletion cpp/src/arrow/flight/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ set(ARROW_FLIGHT_STATIC_LINK_LIBS
gRPC::gpr
c-ares::cares)

if(WIN32)
list(APPEND ARROW_FLIGHT_STATIC_LINK_LIBS Ws2_32.lib)
endif()

if(GRPC_HAS_ADDRESS_SORTING)
list(APPEND ARROW_FLIGHT_STATIC_LINK_LIBS gRPC::address_sorting)
endif()
Expand Down Expand Up @@ -81,6 +85,8 @@ set(ARROW_FLIGHT_SRCS
types.cc)

add_arrow_lib(arrow_flight
OUTPUTS
ARROW_FLIGHT_LIBRARIES
SOURCES
${ARROW_FLIGHT_SRCS}
DEPENDENCIES
Expand All @@ -95,9 +101,15 @@ add_arrow_lib(arrow_flight
arrow_static
${ARROW_FLIGHT_STATIC_LINK_LIBS})

foreach(LIB_TARGET ${ARROW_FLIGHT_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_EXPORTING)
endforeach()

# Define arrow_flight_testing library
if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
add_arrow_lib(arrow_flight_testing
OUTPUTS
ARROW_FLIGHT_TESTING_LIBRARIES
SOURCES
test-util.cc
DEPENDENCIES
Expand All @@ -108,14 +120,20 @@ if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
SHARED_LINK_LIBS
arrow_shared
arrow_flight_shared
arrow_testing_shared
${BOOST_FILESYSTEM_LIBRARY}
${BOOST_SYSTEM_LIBRARY}
GTest::GTest
STATIC_LINK_LIBS
arrow_static
arrow_flight_static)
arrow_flight_static
arrow_testing_static)
endif()

foreach(LIB_TARGET ${ARROW_FLIGHT_TESTING_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_EXPORTING)
endforeach()

add_arrow_test(flight-test
EXTRA_LINK_LIBS
${ARROW_FLIGHT_TEST_LINK_LIBS}
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/arrow/flight/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

#include "arrow/flight/client.h"

// Platform-specific defines
#include "arrow/flight/platform.h"

#include <memory>
#include <sstream>
#include <string>
#include <utility>

#include "arrow/util/config.h"
#ifdef GRPCPP_PP_INCLUDE
#include <grpcpp/grpcpp.h>
#else
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/flight/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

#include "arrow/ipc/writer.h"
#include "arrow/status.h"
#include "arrow/util/visibility.h"

#include "arrow/flight/types.h" // IWYU pragma: keep
#include "arrow/flight/visibility.h"

namespace arrow {

Expand All @@ -46,7 +46,7 @@ class ClientAuthHandler;
typedef std::chrono::duration<double, std::chrono::seconds::period> TimeoutDuration;

/// \brief Hints to the underlying RPC layer for Arrow Flight calls.
class ARROW_EXPORT FlightCallOptions {
class ARROW_FLIGHT_EXPORT FlightCallOptions {
public:
/// Create a default set of call options.
FlightCallOptions();
Expand All @@ -57,14 +57,14 @@ class ARROW_EXPORT FlightCallOptions {
TimeoutDuration timeout;
};

class ARROW_EXPORT FlightClientOptions {
class ARROW_FLIGHT_EXPORT FlightClientOptions {
public:
std::string tls_root_certs;
};

/// \brief Client class for Arrow Flight RPC services (gRPC-based).
/// API experimental for now
class ARROW_EXPORT FlightClient {
class ARROW_FLIGHT_EXPORT FlightClient {
public:
~FlightClient();

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/flight/client_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@

#include <string>

#include "arrow/flight/visibility.h"
#include "arrow/status.h"
#include "arrow/util/visibility.h"

namespace arrow {

namespace flight {

/// \brief A reader for messages from the server during an
/// authentication handshake.
class ARROW_EXPORT ClientAuthReader {
class ARROW_FLIGHT_EXPORT ClientAuthReader {
public:
virtual ~ClientAuthReader() = default;
virtual Status Read(std::string* response) = 0;
};

/// \brief A writer for messages to the server during an
/// authentication handshake.
class ARROW_EXPORT ClientAuthSender {
class ARROW_FLIGHT_EXPORT ClientAuthSender {
public:
virtual ~ClientAuthSender() = default;
virtual Status Write(const std::string& token) = 0;
Expand All @@ -46,7 +46,7 @@ class ARROW_EXPORT ClientAuthSender {
/// Authentication includes both an initial negotiation and a per-call
/// token validation. Implementations may choose to use either or both
/// mechanisms.
class ARROW_EXPORT ClientAuthHandler {
class ARROW_FLIGHT_EXPORT ClientAuthHandler {
public:
virtual ~ClientAuthHandler() = default;
/// \brief Authenticate the client on initial connection. The client
Expand Down
12 changes: 12 additions & 0 deletions cpp/src/arrow/flight/customize_protobuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
#include <limits>
#include <memory>

#include "arrow/flight/platform.h"
#include "arrow/util/config.h"

// Silence protobuf warnings
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#endif

#ifdef GRPCPP_PP_INCLUDE
#include <grpcpp/impl/codegen/config_protobuf.h>
#else
Expand All @@ -40,6 +48,10 @@
#include <grpc++/impl/codegen/proto_utils.h>
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

namespace grpc {

class ByteBuffer;
Expand Down