Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ jobs:
ARROW_FLIGHT: ON
ARROW_FLIGHT_SQL: ON
ARROW_FLIGHT_SQL_ODBC: ON
ARROW_FLIGHT_SQL_ODBC_INSTALLER: ON
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: after ODBC can build in MSVC #48067, need to add ARROW_FLIGHT_SQL_ODBC_INSTALLER: ON in MSVC CI. Leaving this change here for now. Rest of PR can be reviewed.

ARROW_GANDIVA: ON
ARROW_GCS: ON
ARROW_HDFS: OFF
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ java/.mvn/.develocity/
# rat
filtered_rat.txt
rat.txt

# rc
*.rc
Comment on lines +111 to +112
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for ODBC dll

1 change: 1 addition & 0 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ else
-DARROW_FLIGHT=${ARROW_FLIGHT:-OFF} \
-DARROW_FLIGHT_SQL=${ARROW_FLIGHT_SQL:-OFF} \
-DARROW_FLIGHT_SQL_ODBC=${ARROW_FLIGHT_SQL_ODBC:-OFF} \
-DARROW_FLIGHT_SQL_ODBC_INSTALLER=${ARROW_FLIGHT_SQL_ODBC_INSTALLER:-OFF} \
-DARROW_FUZZING=${ARROW_FUZZING:-OFF} \
-DARROW_GANDIVA_PC_CXX_FLAGS=${ARROW_GANDIVA_PC_CXX_FLAGS:-} \
-DARROW_GANDIVA=${ARROW_GANDIVA:-OFF} \
Expand Down
8 changes: 6 additions & 2 deletions cpp/CMakeLists.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For installer to be able to select different components, we needed to add COMPONENT to other parts of Arrow cpp that gets build with ODBC.

Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,13 @@ endif()

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE.txt
${CMAKE_CURRENT_SOURCE_DIR}/../NOTICE.txt
${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION "${ARROW_DOC_DIR}")
${CMAKE_CURRENT_SOURCE_DIR}/README.md
DESTINATION "${ARROW_DOC_DIR}"
COMPONENT arrow_doc)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gdb_arrow.py DESTINATION "${ARROW_GDB_DIR}")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gdb_arrow.py
DESTINATION "${ARROW_GDB_DIR}"
COMPONENT arrow_gdb)

#
# Validate and print out Arrow configuration options
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"ARROW_BUILD_EXAMPLES": "ON",
"ARROW_BUILD_UTILITIES": "ON",
"ARROW_FLIGHT_SQL_ODBC": "ON",
"ARROW_FLIGHT_SQL_ODBC_INSTALLER": "ON",
"ARROW_TENSORFLOW": "ON",
"PARQUET_BUILD_EXAMPLES": "ON",
"PARQUET_BUILD_EXECUTABLES": "ON"
Expand Down
17 changes: 14 additions & 3 deletions cpp/cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ function(arrow_install_cmake_package PACKAGE_NAME EXPORT_NAME)
write_basic_package_version_file("${BUILT_CONFIG_VERSION_CMAKE}"
COMPATIBILITY SameMajorVersion)
install(FILES "${BUILT_CONFIG_CMAKE}" "${BUILT_CONFIG_VERSION_CMAKE}"
DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}")
DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}"
COMPONENT config_cmake_file)
set(TARGETS_CMAKE "${PACKAGE_NAME}Targets.cmake")
install(EXPORT ${EXPORT_NAME}
DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}"
COMPONENT config_cmake_export
NAMESPACE "${PACKAGE_NAME}::"
FILE "${TARGETS_CMAKE}")
endfunction()
Expand Down Expand Up @@ -403,8 +405,11 @@ function(ADD_ARROW_LIB LIB_NAME)
install(TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL}
EXPORT ${LIB_NAME}_targets
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
COMPONENT ${LIB_NAME}_shared_archive
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
COMPONENT ${LIB_NAME}_shared_library
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
COMPONENT ${LIB_NAME}_shared_runtime
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
Expand Down Expand Up @@ -471,8 +476,11 @@ function(ADD_ARROW_LIB LIB_NAME)
install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL}
EXPORT ${LIB_NAME}_targets
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
COMPONENT ${LIB_NAME}_static_library
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
COMPONENT ${LIB_NAME}_static_library
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
COMPONENT ${LIB_NAME}_static_library
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
Expand Down Expand Up @@ -934,7 +942,9 @@ function(ARROW_INSTALL_ALL_HEADERS PATH)
endif()
list(APPEND PUBLIC_HEADERS ${HEADER})
endforeach()
install(FILES ${PUBLIC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PATH}")
install(FILES ${PUBLIC_HEADERS}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PATH}"
COMPONENT ${HEADER}_header)
endfunction()

function(ARROW_ADD_PKG_CONFIG MODULE)
Expand All @@ -944,7 +954,8 @@ function(ARROW_ADD_PKG_CONFIG MODULE)
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${MODULE}.pc"
INPUT "${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.pc.generate.in")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${MODULE}.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/"
COMPONENT ${MODULE}_pkg_config)
endfunction()

# Implementations of lisp "car" and "cdr" functions
Expand Down
13 changes: 8 additions & 5 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ function(provide_cmake_module MODULE_NAME ARROW_CMAKE_PACKAGE_NAME)
message(STATUS "Providing CMake module for ${MODULE_NAME} as part of ${ARROW_CMAKE_PACKAGE_NAME} CMake package"
)
install(FILES "${module}"
DESTINATION "${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}")
DESTINATION "${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}"
COMPONENT ${MODULE_NAME}_module)
endif()
endfunction()

Expand Down Expand Up @@ -2397,20 +2398,22 @@ function(build_gtest)
endforeach()
install(DIRECTORY "${googletest_SOURCE_DIR}/googlemock/include/"
"${googletest_SOURCE_DIR}/googletest/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT gtest_dir)
add_library(arrow::GTest::gtest_headers INTERFACE IMPORTED)
target_include_directories(arrow::GTest::gtest_headers
INTERFACE "${googletest_SOURCE_DIR}/googlemock/include/"
"${googletest_SOURCE_DIR}/googletest/include/")
install(TARGETS gmock gmock_main gtest gtest_main
EXPORT arrow_testing_targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT gtest_runtime
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT gtest_archive
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT gtest_library)
if(MSVC)
install(FILES $<TARGET_PDB_FILE:gmock> $<TARGET_PDB_FILE:gmock_main>
$<TARGET_PDB_FILE:gtest> $<TARGET_PDB_FILE:gtest_main>
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT gtest_pdb
OPTIONAL)
endif()
add_library(arrow::GTest::gmock ALIAS gmock)
Expand Down
13 changes: 9 additions & 4 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ string(REPLACE "${CMAKE_BINARY_DIR}" "<CMAKE_BINARY_DIR>" REDACTED_CXX_FLAGS
configure_file("util/config.h.cmake" "util/config.h" ESCAPE_QUOTES)
configure_file("util/config_internal.h.cmake" "util/config_internal.h" ESCAPE_QUOTES)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/util/config.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/util")
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/util"
COMPONENT arrow_config)

set(ARROW_SRCS
builder.cc
Expand Down Expand Up @@ -1043,7 +1044,8 @@ if(ARROW_BUILD_BUNDLED_DEPENDENCIES)
get_target_property(arrow_bundled_dependencies_path arrow_bundled_dependencies
IMPORTED_LOCATION)
install(FILES ${arrow_bundled_dependencies_path} ${INSTALL_IS_OPTIONAL}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT arrow_bundled_dependencies)
string(PREPEND ARROW_PC_LIBS_PRIVATE " -larrow_bundled_dependencies")
list(INSERT ARROW_STATIC_INSTALL_INTERFACE_LIBS 0 "Arrow::arrow_bundled_dependencies")
endif()
Expand Down Expand Up @@ -1160,6 +1162,7 @@ if(ARROW_BUILD_SHARED AND NOT WIN32)
if(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_INSTALL)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libarrow_gdb.py"
DESTINATION "${ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_DIR}"
COMPONENT arrow_gdb
RENAME "$<TARGET_FILE_NAME:arrow_shared>-gdb.py")
endif()
endif()
Expand Down Expand Up @@ -1223,11 +1226,13 @@ arrow_install_all_headers("arrow")

config_summary_cmake_setters("${CMAKE_CURRENT_BINARY_DIR}/ArrowOptions.cmake")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ArrowOptions.cmake
DESTINATION "${ARROW_CMAKE_DIR}/Arrow")
DESTINATION "${ARROW_CMAKE_DIR}/Arrow"
COMPONENT arrow_options_cmake)

# For backward compatibility for find_package(arrow)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arrow-config.cmake
DESTINATION "${ARROW_CMAKE_DIR}/Arrow")
DESTINATION "${ARROW_CMAKE_DIR}/Arrow"
COMPONENT arrow_config_cmake)

#
# Unit tests
Expand Down
93 changes: 92 additions & 1 deletion cpp/src/arrow/flight/sql/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,28 @@ add_subdirectory(tests)

arrow_install_all_headers("arrow/flight/sql/odbc")

# ODBC Release information
set(ODBC_PACKAGE_VERSION_MAJOR "1")
set(ODBC_PACKAGE_VERSION_MINOR "0")
set(ODBC_PACKAGE_VERSION_PATCH "0")
set(ODBC_PACKAGE_NAME "Apache Arrow Flight SQL ODBC")
set(ODBC_PACKAGE_VENDOR "Apache Arrow")

set(ARROW_FLIGHT_SQL_ODBC_SRCS entry_points.cc odbc_api.cc)

if(WIN32)
list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def)
set(VER_FILEVERSION
"${ODBC_PACKAGE_VERSION_MAJOR},${ODBC_PACKAGE_VERSION_MINOR},${ODBC_PACKAGE_VERSION_PATCH},0"
)
set(VER_FILEVERSION_STR
${ODBC_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}
)
set(VER_COMPANYNAME_STR ${ODBC_PACKAGE_VENDOR})
set(VER_PRODUCTNAME_STR ${ODBC_PACKAGE_NAME})

configure_file("install/versioninfo.rc.in" "install/versioninfo.rc" @ONLY)

list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def install/versioninfo.rc)
endif()

add_arrow_lib(arrow_flight_sql_odbc
Expand Down Expand Up @@ -75,3 +93,76 @@ add_arrow_lib(arrow_flight_sql_odbc
foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_SQL_ODBC_EXPORTING)
endforeach()

# Construct ODBC Windows installer. Only Release installer is supported
if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)

include(InstallRequiredSystemLibraries)

set(CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt")
# Tentative version 1.0.0
set(CPACK_PACKAGE_VERSION_MAJOR ${ODBC_PACKAGE_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${ODBC_PACKAGE_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${ODBC_PACKAGE_VERSION_PATCH})

set(CPACK_PACKAGE_NAME ${ODBC_PACKAGE_NAME})
set(CPACK_PACKAGE_VENDOR ${ODBC_PACKAGE_VENDOR})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver")
set(CPACK_PACKAGE_CONTACT "#GH-47787 TODO arrow maintainers")

# GH-47876 TODO: set up `flight_sql_odbc_lib` component for macOS Installer
# GH-47877 TODO: set up `flight_sql_odbc_lib` component for Linux Installer
if(WIN32)
install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/"
DESTINATION bin
COMPONENT flight_sql_odbc_lib
FILES_MATCHING
# Use regex for dll name patterns with versions
PATTERN "abseil_dll.dll"
PATTERN "arrow.dll"
PATTERN "arrow_compute.dll"
PATTERN "arrow_flight.dll"
PATTERN "arrow_flight_sql.dll"
PATTERN "arrow_flight_sql_odbc.dll"
PATTERN "boost_locale*.dll"
PATTERN "cares.dll"
PATTERN "libcrypto*.dll"
PATTERN "libprotobuf.dll"
PATTERN "libssl*.dll"
PATTERN "re2.dll"
PATTERN "utf8proc.dll"
PATTERN "zlib1.dll")

set(CPACK_WIX_EXTRA_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc.wxs")
set(CPACK_WIX_PATCH_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc-patch.xml")

set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-wix-banner.bmp")
endif()

get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
set(CPACK_COMPONENTS_ALL Unspecified)
list(APPEND CPACK_COMPONENTS_ALL "flight_sql_odbc_lib")

if(WIN32)
# WiX msi installer on Windows
# CPack is compatible with WiX V.5 and V.6
set(CPACK_GENERATOR "WIX")
set(CPACK_WIX_VERSION 4)

# Upgrade GUID is required to be unchanged for ODBC installer to upgrade
set(CPACK_WIX_UPGRADE_GUID "DBF27A18-F8BF-423F-9E3A-957414D52C4B")
set(CPACK_WIX_PRODUCT_GUID "279D087B-93B5-4DC3-BA69-BCF485022A26")
endif()
# GH-47876 TODO: create macOS Installer using cpack
# GH-47877 TODO: create Linux Installer using cpack

# Load CPack after all CPACK* variables are set
include(CPack)
cpack_add_component(flight_sql_odbc_lib
DISPLAY_NAME "ODBC library"
DESCRIPTION "ODBC library bin, required to install"
REQUIRED)
endif()
63 changes: 63 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!---
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.
-->

## Steps to Register the 64-bit Apache Arrow ODBC driver on Windows

After the build succeeds, the ODBC DLL will be located in
`build\debug\Debug` for a debug build and `build\release\Release` for a release build.

1. Open Windows Power Shell as administrator.

2. Register your ODBC DLL:
Need to replace <path\to\repo> with actual path to repository in the commands.

i. `cd to repo.`
ii. `cd <path\to\repo>`
iii. Run script to register your ODBC DLL as Apache Arrow Flight SQL ODBC Driver
`.\cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd <path\to\repo>\cpp\build\< release | debug >\< Release | Debug>\arrow_flight_sql_odbc.dll`
Example command for reference:
`.\cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd C:\path\to\arrow\cpp\build\release\Release\arrow_flight_sql_odbc.dll`

If the registration is successful, then Apache Arrow Flight SQL ODBC Driver
should show as an available ODBC driver in the x64 ODBC Driver Manager.

## Steps to Generate Windows Installer
1. Install WiX toolset v6 from [GitHub](https://github.com/wixtoolset/wix/releases/).
2. Build with `ARROW_FLIGHT_SQL_ODBC=ON` and `ARROW_FLIGHT_SQL_ODBC_INSTALLER=ON`.
3. `cd` to `build` folder.
4. Run `cpack`.

If the generation is successful, you will find `Apache Arrow Flight SQL ODBC-<version>-win64.msi` generated under the `build` folder.


## Steps to Enable Logging
Arrow Flight SQL ODBC driver uses Arrow's internal logging framework. By default, the log messages are printed to the terminal.
1. Set environment variable `ARROW_ODBC_LOG_LEVEL` to any of the following valid values to enable logging. If `ARROW_ODBC_LOG_LEVEL` is set to a non-empty string that does not match any of the following values, `DEBUG` level is used by default.

The characters are case-insensitive.
- TRACE
- DEBUG
- INFO
- WARNING
- ERROR
- FATAL

The Windows ODBC driver currently does not support writing log files. `ARROW_USE_GLOG` is required to write log files, and `ARROW_USE_GLOG` is disabled on Windows platform since plasma using `glog` is not fully tested on windows.

Note: GH-47670 running more than 1 tests with logging enabled is not fully supported.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
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.
-->

<CPackWiXPatch>
<CPackWiXFragment Id="#PRODUCTFEATURE">
<ComponentRef Id="ODBCRegistryEntries"/>
</CPackWiXFragment>
</CPackWiXPatch>
Loading
Loading