Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
778cbd2
Enable ODBC build on MSVC CI
alinaliBQ Nov 5, 2025
eb2a6f2
Enable Flight & Flight SQL for ODBC
alinaliBQ Nov 5, 2025
f9b64c8
Remove `ARROW_BOOST_USE_SHARED`
alinaliBQ Nov 5, 2025
6c6faf0
`ARROW_BUILD_BENCHMARKS` prevents Flight from being built
alinaliBQ Nov 5, 2025
e81260f
Enable static build on MSVC
alinaliBQ Nov 5, 2025
adc4cce
Set ARROW_DEPENDENCY_SOURCE to VCPKG
alinaliBQ Nov 5, 2025
d67f3fe
Specify VCPKG_TARGET_TRIPLET as x64 windows
alinaliBQ Nov 5, 2025
feede59
Specify `VCPKG_BINARY_SOURCES` and `VCPKG_DEFAULT_TRIPLET`
alinaliBQ Nov 5, 2025
2018387
Empty commit to trigger CI
alinaliBQ Nov 5, 2025
79257b4
Extend run-time to 2hr
alinaliBQ Nov 5, 2025
3fd52ad
Remove `CMAKE_CXX_STANDARD` 17
alinaliBQ Nov 5, 2025
f1493e8
Add `/EHsc` flag
alinaliBQ Nov 5, 2025
99198bf
Add VCPKG set up
alinaliBQ Nov 6, 2025
b6adbfd
Set ARROW_BOOST_USE_SHARED to OFF
alinaliBQ Nov 6, 2025
e3e3862
Change to release build
alinaliBQ Nov 7, 2025
36ea943
Remove `ARROW_BOOST_USE_SHARED = OFF`
alinaliBQ Nov 7, 2025
5b83635
Remove `BOOST_SOURCE=BUNDLED` to use vcpkg's dynamic link to boost
alinaliBQ Nov 7, 2025
6961176
[GH-48084] Replace boost::optional with std::optional
alinaliBQ Oct 2, 2025
d45d2f7
Attempt to resolve conflict with sql/types.h
alinaliBQ Nov 10, 2025
73a92ee
Add `#pragma once` to odbc_test_suite.h
alinaliBQ Nov 10, 2025
bf6b69c
Undefine duplicates in SQLGetInfo
alinaliBQ Nov 10, 2025
63cd922
Add `sql_info_undef.h` to sqlite_sql_info.cc
alinaliBQ Nov 11, 2025
8d1d561
Fix lint
alinaliBQ Nov 11, 2025
53a04f3
Remove debug messages
alinaliBQ Nov 11, 2025
8af22dc
Disable `UNITY_BUILD` for ODBC test due to conflict on `sqlite_sql_in…
alinaliBQ Nov 12, 2025
588fc9d
Attempt to resolve `arrow-compute-grouper-benchmark` build issue
alinaliBQ Nov 12, 2025
3030aa0
Link ODBC library on all platforms
alinaliBQ Nov 13, 2025
4e9461d
Fix ODBC dll name
alinaliBQ Nov 13, 2025
69475da
Set `VCPKG_ROOT` in test phase
alinaliBQ Nov 13, 2025
646f347
Convert VCPKG Windows path to MSYS path
alinaliBQ Nov 14, 2025
97b30d2
Prepend vcpkg to search vcpkg before `<prefix>/lib/cmake`
alinaliBQ Nov 14, 2025
763bbe5
Run ODBC test once outside of test script
alinaliBQ Nov 15, 2025
6145eda
Enable regular ctest tests
alinaliBQ Nov 18, 2025
dcfa218
Draft enable ODBC global setup/teardown
alinaliBQ Nov 18, 2025
92f434f
Code Clean up and enable ODBC tests in CI
alinaliBQ Nov 19, 2025
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
52 changes: 47 additions & 5 deletions .github/workflows/cpp_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ on:
jobs:
windows:
runs-on: ${{ inputs.os }}
timeout-minutes: 60
timeout-minutes: 240
env:
ARROW_BOOST_USE_SHARED: OFF
ARROW_BUILD_BENCHMARKS: ON
ARROW_BUILD_SHARED: ON
ARROW_BUILD_STATIC: OFF
ARROW_BUILD_STATIC: ON
ARROW_BUILD_TESTS: ON
ARROW_BUILD_TYPE: release
ARROW_DATASET: ON
ARROW_FLIGHT: OFF
ARROW_DEPENDENCY_SOURCE: VCPKG
ARROW_FLIGHT: ON
ARROW_FLIGHT_SQL: ON
ARROW_FLIGHT_SQL_ODBC: ON
ARROW_HDFS: ON
ARROW_HOME: /usr
ARROW_JEMALLOC: OFF
Expand All @@ -62,11 +65,12 @@ jobs:
ARROW_WITH_SNAPPY: ON
ARROW_WITH_ZLIB: ON
ARROW_WITH_ZSTD: ON
BOOST_SOURCE: BUNDLED
CMAKE_CXX_STANDARD: "17"
CMAKE_GENERATOR: Ninja
CMAKE_INSTALL_PREFIX: /usr
CMAKE_UNITY_BUILD: ON
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
VCPKG_DEFAULT_TRIPLET: x64-windows
steps:
- name: Disable Crash Dialogs
run: |
Expand Down Expand Up @@ -110,15 +114,53 @@ jobs:
path: ${{ steps.ccache-info.outputs.cache-dir }}
key: cpp-ccache-windows-${{ inputs.arch }}-${{ hashFiles('cpp/**') }}
restore-keys: cpp-ccache-windows-${{ inputs.arch }}-
- name: Checkout vcpkg
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
path: vcpkg
repository: microsoft/vcpkg
- name: Bootstrap vcpkg
run: |
vcpkg\bootstrap-vcpkg.bat
$VCPKG_ROOT = $(Resolve-Path -LiteralPath "vcpkg").ToString()
Write-Output ${VCPKG_ROOT} | `
Out-File -FilePath ${Env:GITHUB_PATH} -Encoding utf8 -Append
Write-Output "VCPKG_ROOT=${VCPKG_ROOT}" | `
Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append
- name: Setup NuGet credentials for vcpkg caching
shell: bash
run: |
$(vcpkg fetch nuget | tail -n 1) \
sources add \
-source "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" \
-storepasswordincleartext \
-name "GitHub" \
-username "$GITHUB_REPOSITORY_OWNER" \
-password "${{ secrets.GITHUB_TOKEN }}"
$(vcpkg fetch nuget | tail -n 1) \
setapikey "${{ secrets.GITHUB_TOKEN }}" \
-source "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json"
- name: Build
shell: cmd
run: |
set VCPKG_ROOT_KEEP=%VCPKG_ROOT%
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ inputs.arch }}
set VCPKG_ROOT=%VCPKG_ROOT_KEEP%
bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build"
- name: Register Flight SQL ODBC Driver
shell: cmd
run: |
call "cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd" ${{ github.workspace }}\build\cpp\%ARROW_BUILD_TYPE%\arrow_flight_sql_odbc.dll
- name: Test
shell: cmd
run: |
set VCPKG_ROOT_KEEP=%VCPKG_ROOT%
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ inputs.arch }}
# For ORC
set TZDIR=${{ steps.setup-msys2.outputs.msys2-location }}\usr\share\zoneinfo

# Convert VCPKG Windows path to MSYS path
for /f "usebackq delims=" %%I in (`bash -c "cygpath -u \"$VCPKG_ROOT_KEEP\""` ) do set VCPKG_ROOT=%%I

bash -c "ci/scripts/cpp_test.sh $(pwd) $(pwd)/build"
3 changes: 2 additions & 1 deletion ci/scripts/cpp_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ if [ "${ARROW_USE_MESON:-OFF}" = "OFF" ] && \
CMAKE_PREFIX_PATH+="/lib/cmake/"
;;
esac
# Search vcpkg before <prefix>/lib/cmake.
if [ -n "${VCPKG_ROOT}" ] && [ -n "${VCPKG_DEFAULT_TRIPLET}" ]; then
CMAKE_PREFIX_PATH+=";${VCPKG_ROOT}/installed/${VCPKG_DEFAULT_TRIPLET}"
CMAKE_PREFIX_PATH="${VCPKG_ROOT}/installed/${VCPKG_DEFAULT_TRIPLET};${CMAKE_PREFIX_PATH}"
fi
cmake \
-S "${source_dir}/examples/minimal_build" \
Expand Down
1 change: 1 addition & 0 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ if(WIN32)
#
# ARROW-2986: Without /EHsc we get C4530 warning
set(CXX_COMMON_FLAGS "/W3 /EHsc")
string(APPEND CMAKE_CXX_FLAGS " /EHsc")
endif()

# Disable C5105 (macro expansion producing 'defined' has undefined
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/compute/registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class FunctionRegistry::FunctionRegistryImpl {

const Function* cast_function() { return cast_function_; }

void ClearFunctioRegistry() { name_to_function_.clear(); }

private:
// must not acquire mutex
Status CanAddFunctionName(const std::string& name, bool allow_overwrite) {
Expand Down Expand Up @@ -277,6 +279,8 @@ int FunctionRegistry::num_functions() const { return impl_->num_functions(); }

const Function* FunctionRegistry::cast_function() const { return impl_->cast_function(); }

void FunctionRegistry::ClearFunctioRegistry() { impl_->ClearFunctioRegistry(); }

namespace internal {

static std::unique_ptr<FunctionRegistry> CreateBuiltInRegistry() {
Expand Down
5 changes: 5 additions & 0 deletions cpp/src/arrow/compute/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ class ARROW_EXPORT FunctionRegistry {
/// Helpful for get cast function as needed.
const Function* cast_function() const;

/// \brief Clear function registry
///
/// Helpful to avoid segfault from race condition. Call this function before DLL unload.
void ClearFunctioRegistry();

private:
FunctionRegistry();

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/row/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arrow_install_all_headers("arrow/compute/row")

if(ARROW_BUILD_BENCHMARKS AND ARROW_COMPUTE)
add_arrow_benchmark(grouper_benchmark PREFIX "arrow-compute")
if(ARROW_BUILD_STATIC)
if(ARROW_TEST_LINKAGE STREQUAL "static")
target_link_libraries(arrow-compute-grouper-benchmark PUBLIC arrow_compute_static)
else()
target_link_libraries(arrow-compute-grouper-benchmark PUBLIC arrow_compute_shared)
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/flight/sql/example/sqlite_sql_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "arrow/flight/sql/types.h"
#include "arrow/util/config.h"

#include "arrow/flight/sql/sql_info_undef.h"

namespace arrow {
namespace flight {
namespace sql {
Expand Down
10 changes: 3 additions & 7 deletions cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,9 @@ if(WIN32)
system_dsn.h)
endif()

target_link_libraries(arrow_odbc_spi_impl PUBLIC arrow_flight_sql_shared
arrow_compute_shared Boost::locale)

# Link libraries on MINGW64 and macOS
if(MINGW OR APPLE)
target_link_libraries(arrow_odbc_spi_impl PUBLIC ${ODBCINST})
endif()
target_link_libraries(arrow_odbc_spi_impl
PUBLIC arrow_flight_sql_shared arrow_compute_shared Boost::locale
${ODBCINST})

set_target_properties(arrow_odbc_spi_impl
PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/flight/sql/odbc/odbc_impl/blocking_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#pragma once

#include <atomic>
#include <boost/optional.hpp>
#include <condition_variable>
#include <mutex>
#include <optional>
#include <thread>
#include <vector>

Expand All @@ -43,7 +43,7 @@ class BlockingQueue {
std::atomic<bool> closed_{false};

public:
typedef std::function<boost::optional<T>(void)> Supplier;
typedef std::function<std::optional<T>(void)> Supplier;

explicit BlockingQueue(size_t capacity) : capacity_(capacity), buffer_(capacity) {}

Expand All @@ -58,7 +58,7 @@ class BlockingQueue {

// Only one thread at a time be notified and call supplier
auto item = supplier();
if (!item) break;
if (!item.has_value()) break;

Push(*item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "arrow/result.h"
#include "arrow/status.h"

#include <optional>
#include <utility>

namespace arrow::flight::sql::odbc {
Expand Down Expand Up @@ -63,7 +64,7 @@ class UserPasswordAuthMethod : public FlightSqlAuthMethod {
void Authenticate(FlightSqlConnection& connection,
FlightCallOptions& call_options) override {
FlightCallOptions auth_call_options;
const boost::optional<Connection::Attribute>& login_timeout =
const std::optional<Connection::Attribute>& login_timeout =
connection.GetAttribute(Connection::LOGIN_TIMEOUT);
if (login_timeout && boost::get<uint32_t>(*login_timeout) > 0) {
// ODBC's LOGIN_TIMEOUT attribute and FlightCallOptions.timeout use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <boost/algorithm/string/join.hpp>
#include <boost/asio/ip/address.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>
#include "arrow/flight/sql/odbc/odbc_impl/exceptions.h"

#include <sql.h>
Expand Down Expand Up @@ -199,7 +198,7 @@ void FlightSqlConnection::PopulateMetadataSettings(
metadata_settings_.chunk_buffer_capacity = GetChunkBufferCapacity(conn_property_map);
}

boost::optional<int32_t> FlightSqlConnection::GetStringColumnLength(
std::optional<int32_t> FlightSqlConnection::GetStringColumnLength(
const Connection::ConnPropertyMap& conn_property_map) {
const int32_t min_string_column_length = 1;

Expand All @@ -214,7 +213,7 @@ boost::optional<int32_t> FlightSqlConnection::GetStringColumnLength(
"01000", ODBCErrorCodes_GENERAL_WARNING);
}

return boost::none;
return std::nullopt;
}

bool FlightSqlConnection::GetUseWideChar(const ConnPropertyMap& conn_property_map) {
Expand Down Expand Up @@ -250,7 +249,7 @@ const FlightCallOptions& FlightSqlConnection::PopulateCallOptions(
const ConnPropertyMap& props) {
// Set CONNECTION_TIMEOUT attribute or LOGIN_TIMEOUT depending on if this
// is the first request.
const boost::optional<Connection::Attribute>& connection_timeout =
const std::optional<Connection::Attribute>& connection_timeout =
closed_ ? GetAttribute(LOGIN_TIMEOUT) : GetAttribute(CONNECTION_TIMEOUT);
if (connection_timeout && boost::get<uint32_t>(*connection_timeout) > 0) {
call_options_.timeout =
Expand Down Expand Up @@ -388,17 +387,21 @@ bool FlightSqlConnection::SetAttribute(Connection::AttributeId attribute,
}
}

boost::optional<Connection::Attribute> FlightSqlConnection::GetAttribute(
std::optional<Connection::Attribute> FlightSqlConnection::GetAttribute(
Connection::AttributeId attribute) {
switch (attribute) {
case ACCESS_MODE:
// FlightSQL does not provide this metadata.
return boost::make_optional(Attribute(static_cast<uint32_t>(SQL_MODE_READ_WRITE)));
return std::make_optional(Attribute(static_cast<uint32_t>(SQL_MODE_READ_WRITE)));
case PACKET_SIZE:
return boost::make_optional(Attribute(static_cast<uint32_t>(0)));
return std::make_optional(Attribute(static_cast<uint32_t>(0)));
default:
const auto& it = attribute_.find(attribute);
return boost::make_optional(it != attribute_.end(), it->second);
if (it != attribute_.end()) {
return std::make_optional(it->second);
} else {
return std::nullopt;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "arrow/flight/sql/odbc/odbc_impl/spi/connection.h"

#include <optional>
#include <vector>
#include "arrow/flight/api.h"
#include "arrow/flight/sql/api.h"
Expand Down Expand Up @@ -84,7 +85,7 @@ class FlightSqlConnection : public Connection {

bool SetAttribute(AttributeId attribute, const Attribute& value) override;

boost::optional<Connection::Attribute> GetAttribute(
std::optional<Connection::Attribute> GetAttribute(
Connection::AttributeId attribute) override;

Info GetInfo(uint16_t info_type) override;
Expand All @@ -111,8 +112,7 @@ class FlightSqlConnection : public Connection {
/// \note Visible for testing
void SetClosed(bool is_closed);

boost::optional<int32_t> GetStringColumnLength(
const ConnPropertyMap& conn_property_map);
std::optional<int32_t> GetStringColumnLength(const ConnPropertyMap& conn_property_map);

bool GetUseWideChar(const ConnPropertyMap& conn_property_map);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
#include "arrow/flight/types.h"
#include "gtest/gtest.h"

#include <optional>

namespace arrow::flight::sql::odbc {

TEST(AttributeTests, SetAndGetAttribute) {
FlightSqlConnection connection(OdbcVersion::V_3);
connection.SetClosed(false);

connection.SetAttribute(Connection::CONNECTION_TIMEOUT, static_cast<uint32_t>(200));
const boost::optional<Connection::Attribute> first_value =
const std::optional<Connection::Attribute> first_value =
connection.GetAttribute(Connection::CONNECTION_TIMEOUT);

EXPECT_TRUE(first_value);
Expand All @@ -37,7 +39,7 @@ TEST(AttributeTests, SetAndGetAttribute) {

connection.SetAttribute(Connection::CONNECTION_TIMEOUT, static_cast<uint32_t>(300));

const boost::optional<Connection::Attribute> change_value =
const std::optional<Connection::Attribute> change_value =
connection.GetAttribute(Connection::CONNECTION_TIMEOUT);

EXPECT_TRUE(change_value);
Expand All @@ -49,7 +51,7 @@ TEST(AttributeTests, SetAndGetAttribute) {
TEST(AttributeTests, GetAttributeWithoutSetting) {
FlightSqlConnection connection(OdbcVersion::V_3);

const boost::optional<Connection::Attribute> optional =
const std::optional<Connection::Attribute> optional =
connection.GetAttribute(Connection::CONNECTION_TIMEOUT);
connection.SetClosed(false);

Expand All @@ -72,7 +74,7 @@ TEST(MetadataSettingsTest, StringColumnLengthTest) {
std::to_string(expected_string_column_length)},
};

const boost::optional<int32_t> actual_string_column_length =
const std::optional<int32_t> actual_string_column_length =
connection.GetStringColumnLength(properties);

EXPECT_TRUE(actual_string_column_length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "arrow/flight/sql/odbc/odbc_impl/util.h"
#include "arrow/io/memory.h"

#include <boost/optional.hpp>
#include <optional>
#include <utility>
#include "arrow/flight/sql/odbc/odbc_impl/exceptions.h"

Expand Down Expand Up @@ -89,13 +89,17 @@ bool FlightSqlStatement::SetAttribute(StatementAttributeId attribute,
}
}

boost::optional<Statement::Attribute> FlightSqlStatement::GetAttribute(
std::optional<Statement::Attribute> FlightSqlStatement::GetAttribute(
StatementAttributeId attribute) {
const auto& it = attribute_.find(attribute);
return boost::make_optional(it != attribute_.end(), it->second);
if (it != attribute_.end()) {
return std::make_optional(it->second);
} else {
return std::nullopt;
}
}

boost::optional<std::shared_ptr<ResultSetMetadata>> FlightSqlStatement::Prepare(
std::optional<std::shared_ptr<ResultSetMetadata>> FlightSqlStatement::Prepare(
const std::string& query) {
ClosePreparedStatementIfAny(prepared_statement_);

Expand All @@ -107,7 +111,7 @@ boost::optional<std::shared_ptr<ResultSetMetadata>> FlightSqlStatement::Prepare(

const auto& result_set_metadata = std::make_shared<FlightSqlResultSetMetadata>(
prepared_statement_->dataset_schema(), metadata_settings_);
return boost::optional<std::shared_ptr<ResultSetMetadata>>(result_set_metadata);
return std::optional<std::shared_ptr<ResultSetMetadata>>(result_set_metadata);
}

bool FlightSqlStatement::ExecutePrepared() {
Expand Down
Loading
Loading