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

[GAC-39] update Arrow version that flightsql-odbc (Dremio Seed) works with #11

Draft
wants to merge 2 commits into
base: GAC-odbc-driver
Choose a base branch
from
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
29 changes: 29 additions & 0 deletions .github/workflows/flightsqlodbc_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Flight SQL ODBC Driver Client for Windows

on:
push:
paths:
- '.github/workflows/flightsqlodbc_build.yml'
- 'cpp/src/flightsql_odbc/flightsql-odbc/**'
pull_request:
paths:
- '.github/workflows/flightsqlodbc_build.yml'
- 'cpp/src/flightsql_odbc/flightsql-odbc/**'

env:
VCPKG_ROOT: "c:/vcpkg"

jobs:
build-windows64:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
# Use cmake 3.25 to stably build flightsql-odbc
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version

- name: configure-and-build-driver
run: |
cd cpp/src/flightsql_odbc/flightsql-odbc
.\build_win64.bat
2 changes: 1 addition & 1 deletion cpp/src/flightsql_odbc/flightsql-odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

cmake_minimum_required(VERSION 3.11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

project(flightsql_odbc)

Expand Down
4 changes: 3 additions & 1 deletion cpp/src/flightsql_odbc/flightsql-odbc/build_win32.bat
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ mkdir build

cd build

if NOT DEFINED ARROW_GIT_REPOSITORY SET ARROW_GIT_REPOSITORY = "https://github.com/apache/arrow"
if NOT DEFINED ARROW_GIT_REPOSITORY (
SET ARROW_GIT_REPOSITORY="https://github.com/apache/arrow"
)

cmake ..^
-DARROW_GIT_REPOSITORY=%ARROW_GIT_REPOSITORY%^
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/flightsql_odbc/flightsql-odbc/build_win64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ mkdir build

cd build

if NOT DEFINED ARROW_GIT_REPOSITORY SET ARROW_GIT_REPOSITORY = "https://github.com/apache/arrow"
if NOT DEFINED ARROW_GIT_REPOSITORY (
SET ARROW_GIT_REPOSITORY="https://github.com/apache/arrow"
)

cmake ..^
-DARROW_GIT_REPOSITORY=%ARROW_GIT_REPOSITORY%^
Expand Down
10 changes: 6 additions & 4 deletions cpp/src/flightsql_odbc/flightsql-odbc/flight_sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

cmake_minimum_required(VERSION 3.11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down Expand Up @@ -113,11 +113,13 @@ else()
)
endif()

# If build fails, need to remove build folder to re-build.
set(ARROW_GIT_REPOSITORY "https://github.com/apache/arrow.git" CACHE STRING "Arrow repository path or URL")
set(ARROW_GIT_TAG "b050bd0d31db6412256cec3362c0d57c9732e1f2" CACHE STRING "Tag for the Arrow repository")
set(ARROW_GIT_TAG "apache-arrow-14.0.1" CACHE STRING "Tag for the Arrow repository")

message("Using Arrow from ${ARROW_GIT_REPOSITORY} on tag ${ARROW_GIT_TAG}")
ExternalProject_Add(ApacheArrow
ExternalProject_Add(
ApacheArrow
GIT_REPOSITORY ${ARROW_GIT_REPOSITORY}
GIT_TAG ${ARROW_GIT_TAG}
CMAKE_ARGS ${ARROW_CMAKE_ARGS})
Expand All @@ -132,7 +134,7 @@ link_directories(${CMAKE_CURRENT_BINARY_DIR}/ApacheArrow-prefix/src/ApacheArrow-

if (MSVC)
# the following definitions stop arrow from using __declspec when staticly linking and will break on windows without them
add_compile_definitions(ARROW_STATIC ARROW_FLIGHT_STATIC)
add_compile_definitions(ARROW_STATIC ARROW_FLIGHT_STATIC ARROW_FLIGHT_SQL_STATIC)
endif()

enable_testing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ class UserPasswordAuthMethod : public FlightSqlAuthMethod {
FlightCallOptions auth_call_options;
const boost::optional<Connection::Attribute> &login_timeout =
connection.GetAttribute(Connection::LOGIN_TIMEOUT);
if (login_timeout && boost::get<uint32_t>(*login_timeout) > 0) {
if (login_timeout && std::get<uint32_t>(*login_timeout) > 0) {
// ODBC's LOGIN_TIMEOUT attribute and FlightCallOptions.timeout use
// seconds as time unit.
double timeout_seconds = static_cast<double>(boost::get<uint32_t>(*login_timeout));
double timeout_seconds = static_cast<double>(std::get<uint32_t>(*login_timeout));
if (timeout_seconds > 0) {
auth_call_options.timeout = TimeoutDuration{timeout_seconds};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void FlightSqlConnection::Connect(const ConnPropertyMap &properties,

std::unique_ptr<FlightClient> flight_client;
ThrowIfNotOK(
FlightClient::Connect(location, client_options, &flight_client));
FlightClient::Connect(location, client_options).Value(&flight_client));

std::unique_ptr<FlightSqlAuthMethod> auth_method =
FlightSqlAuthMethod::FromProperties(flight_client, properties);
Expand Down Expand Up @@ -251,9 +251,9 @@ FlightSqlConnection::PopulateCallOptions(const ConnPropertyMap &props) {
// is the first request.
const boost::optional<Connection::Attribute> &connection_timeout = closed_ ?
GetAttribute(LOGIN_TIMEOUT) : GetAttribute(CONNECTION_TIMEOUT);
if (connection_timeout && boost::get<uint32_t>(*connection_timeout) > 0) {
if (connection_timeout && std::get<uint32_t>(*connection_timeout) > 0) {
call_options_.timeout =
TimeoutDuration{static_cast<double>(boost::get<uint32_t>(*connection_timeout))};
TimeoutDuration{static_cast<double>(std::get<uint32_t>(*connection_timeout))};
}

for (auto prop : props) {
Expand Down Expand Up @@ -342,7 +342,7 @@ FlightSqlConnection::BuildLocation(const ConnPropertyMap &properties,
operation_result = address_info.GetAddressInfo(host, host_name_info,
NI_MAXHOST);
if (operation_result) {
ThrowIfNotOK(Location::ForGrpcTls(host_name_info, port, &location));
ThrowIfNotOK(Location::ForGrpcTls(host_name_info, port).Value(&location));
return location;
}
// TODO: We should log that we could not convert an IP to hostname here.
Expand All @@ -353,11 +353,11 @@ FlightSqlConnection::BuildLocation(const ConnPropertyMap &properties,
// if it is not an IP.
}

ThrowIfNotOK(Location::ForGrpcTls(host, port, &location));
ThrowIfNotOK(Location::ForGrpcTls(host, port).Value(&location));
return location;
}

ThrowIfNotOK(Location::ForGrpcTcp(host, port, &location));
ThrowIfNotOK(Location::ForGrpcTcp(host, port).Value(&location));
return location;
}

Expand Down Expand Up @@ -415,7 +415,7 @@ Connection::Info FlightSqlConnection::GetInfo(uint16_t info_type) {
if (info_type == SQL_DBMS_NAME || info_type == SQL_SERVER_NAME) {
// Update the database component reported in error messages.
// We do this lazily for performance reasons.
diagnostics_.SetDataSourceComponent(boost::get<std::string>(result));
diagnostics_.SetDataSourceComponent(std::get<std::string>(result));
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ TEST(AttributeTests, SetAndGetAttribute) {

EXPECT_TRUE(firstValue);

EXPECT_EQ(boost::get<uint32_t>(*firstValue), static_cast<uint32_t>(200));
EXPECT_EQ(std::get<uint32_t>(*firstValue), static_cast<uint32_t>(200));

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

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

EXPECT_TRUE(changeValue);
EXPECT_EQ(boost::get<uint32_t>(*changeValue), static_cast<uint32_t>(300));
EXPECT_EQ(std::get<uint32_t>(*changeValue), static_cast<uint32_t>(300));

connection.Close();
}
Expand All @@ -48,7 +48,7 @@ TEST(AttributeTests, GetAttributeWithoutSetting) {
connection.GetAttribute(Connection::CONNECTION_TIMEOUT);
connection.SetClosed(false);

EXPECT_EQ(0, boost::get<uint32_t>(*optional));
EXPECT_EQ(0, std::get<uint32_t>(*optional));

connection.Close();
}
Expand Down Expand Up @@ -113,7 +113,7 @@ TEST(BuildLocationTests, ForTcp) {

Location expected_location;
ASSERT_TRUE(
Location::ForGrpcTcp("localhost", 32010, &expected_location).ok());
Location::ForGrpcTcp("localhost", 32010).Value(&expected_location).ok());
ASSERT_EQ(expected_location, actual_location1);
ASSERT_NE(expected_location, actual_location2);
}
Expand Down Expand Up @@ -146,7 +146,7 @@ TEST(BuildLocationTests, ForTls) {

Location expected_location;
ASSERT_TRUE(
Location::ForGrpcTls("localhost", 32010, &expected_location).ok());
Location::ForGrpcTls("localhost", 32010).Value(&expected_location).ok());
ASSERT_EQ(expected_location, actual_location1);
ASSERT_NE(expected_location, actual_location2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace driver {
namespace flight_sql {

using arrow::internal::checked_pointer_cast;
using arrow::util::nullopt;
using std::nullopt;

GetTablesReader::GetTablesReader(std::shared_ptr<RecordBatch> record_batch)
: record_batch_(std::move(record_batch)), current_row_(-1) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
*/

#include "record_batch_transformer.h"
#include <arrow/util/optional.h>

namespace driver {
namespace flight_sql {

using namespace arrow;
using arrow::util::optional;
using std::optional;

class GetTablesReader {
private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace driver {
namespace flight_sql {

using arrow::internal::checked_pointer_cast;
using arrow::util::nullopt;
using std::nullopt;

GetTypeInfoReader::GetTypeInfoReader(std::shared_ptr<RecordBatch> record_batch)
: record_batch_(std::move(record_batch)), current_row_(-1) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
* See "LICENSE" for license information.
*/

#include <optional>

#include "record_batch_transformer.h"
#include <arrow/util/optional.h>

namespace driver {
namespace flight_sql {

using namespace arrow;
using arrow::util::optional;
using std::optional;

class GetTypeInfoReader {
private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ FlightSqlResultSet::FlightSqlResultSet(
if (transformer_) {
schema_ = transformer_->GetTransformedSchema();
} else {
ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema_));
ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema_));
}

for (size_t i = 0; i < columns_.size(); ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ namespace flight_sql {
using namespace odbcabstraction;
using arrow::DataType;
using arrow::Field;
using arrow::util::make_optional;
using arrow::util::nullopt;
using std::make_optional;
using std::nullopt;

constexpr int32_t DefaultDecimalPrecision = 38;

Expand Down Expand Up @@ -251,7 +251,7 @@ FlightSqlResultSetMetadata::FlightSqlResultSetMetadata(
metadata_settings_(metadata_settings){
arrow::ipc::DictionaryMemo dict_memo;

ThrowIfNotOK(flight_info->GetSchema(&dict_memo, &schema_));
ThrowIfNotOK(flight_info->GetSchema(&dict_memo).Value(&schema_));
}

} // namespace flight_sql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ bool FlightSqlStatement::SetAttribute(StatementAttributeId attribute,
case MAX_LENGTH:
return CheckIfSetToOnlyValidValue(value, static_cast<size_t>(0));
case QUERY_TIMEOUT:
if (boost::get<size_t>(value) > 0) {
if (std::get<size_t>(value) > 0) {
call_options_.timeout =
TimeoutDuration{static_cast<double>(boost::get<size_t>(value))};
TimeoutDuration{static_cast<double>(std::get<size_t>(value))};
} else {
call_options_.timeout = TimeoutDuration{-1};
// Intentional fall-through.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ namespace driver {
namespace flight_sql {

using arrow::flight::sql::ColumnMetadata;
using arrow::util::make_optional;
using arrow::util::nullopt;
using arrow::util::optional;
using std::make_optional;
using std::nullopt;
using std::optional;

namespace {
std::shared_ptr<Schema> GetColumns_V3_Schema() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
* See "LICENSE" for license information.
*/

#include <optional>

#include "record_batch_transformer.h"
#include <arrow/array/builder_binary.h>
#include <arrow/array/builder_primitive.h>
#include <arrow/status.h>
#include <arrow/util/optional.h>
#include <odbcabstraction/types.h>

namespace driver {
namespace flight_sql {

using odbcabstraction::MetadataSettings;
using arrow::util::optional;
using std::optional;

class GetColumns_RecordBatchBuilder {
private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ GetTablesForSQLAllCatalogs(const ColumnNames &names,

ThrowIfNotOK(result.status());
flight_info = result.ValueOrDie();
ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema));
ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema));

auto transformer = RecordBatchTransformerWithTasksBuilder(schema)
.RenameField("catalog_name", names.catalog_column)
Expand All @@ -102,7 +102,7 @@ std::shared_ptr<ResultSet> GetTablesForSQLAllDbSchemas(

ThrowIfNotOK(result.status());
flight_info = result.ValueOrDie();
ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema));
ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema));

auto transformer = RecordBatchTransformerWithTasksBuilder(schema)
.AddFieldOfNulls(names.catalog_column, utf8())
Expand Down Expand Up @@ -130,7 +130,7 @@ GetTablesForSQLAllTableTypes(const ColumnNames &names,

ThrowIfNotOK(result.status());
flight_info = result.ValueOrDie();
ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema));
ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema));

auto transformer = RecordBatchTransformerWithTasksBuilder(schema)
.AddFieldOfNulls(names.catalog_column, utf8())
Expand Down Expand Up @@ -158,7 +158,7 @@ std::shared_ptr<ResultSet> GetTablesForGenericUse(

ThrowIfNotOK(result.status());
flight_info = result.ValueOrDie();
ThrowIfNotOK(flight_info->GetSchema(nullptr, &schema));
ThrowIfNotOK(flight_info->GetSchema(nullptr).Value(&schema));

auto transformer = RecordBatchTransformerWithTasksBuilder(schema)
.RenameField("catalog_name", names.catalog_column)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
namespace driver {
namespace flight_sql {

using arrow::util::make_optional;
using arrow::util::nullopt;
using arrow::util::optional;
using std::make_optional;
using std::nullopt;
using std::optional;

namespace {
std::shared_ptr<Schema> GetTypeInfo_V3_Schema() {
Expand Down
Loading
Loading