Skip to content

Commit cfcebea

Browse files
authored
Add support for Apache Arrow C++ 13.0.0 or later (#194)
Closes GH-193
1 parent 5d2f0d4 commit cfcebea

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/afs.cc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4083,7 +4083,7 @@ class FlightSQLServer : public arrow::flight::sql::FlightSqlServerBase {
40834083
ARROW_ASSIGN_OR_RAISE(auto ticket,
40844084
arrow::flight::sql::CreateStatementQueryTicket(query));
40854085
std::vector<arrow::flight::FlightEndpoint> endpoints{
4086-
arrow::flight::FlightEndpoint{arrow::flight::Ticket{std::move(ticket)}, {}}};
4086+
create_endpoint(std::move(ticket))};
40874087
ARROW_ASSIGN_OR_RAISE(
40884088
auto result,
40894089
arrow::flight::FlightInfo::Make(*schema, descriptor, endpoints, -1, -1));
@@ -4140,7 +4140,7 @@ class FlightSQLServer : public arrow::flight::sql::FlightSqlServerBase {
41404140
ARROW_ASSIGN_OR_RAISE(auto ticket,
41414141
arrow::flight::sql::CreateStatementQueryTicket(handle));
41424142
std::vector<arrow::flight::FlightEndpoint> endpoints{
4143-
arrow::flight::FlightEndpoint{arrow::flight::Ticket{std::move(ticket)}, {}}};
4143+
create_endpoint(std::move(ticket))};
41444144
ARROW_ASSIGN_OR_RAISE(
41454145
auto result,
41464146
arrow::flight::FlightInfo::Make(*schema, descriptor, endpoints, -1, -1));
@@ -4169,6 +4169,21 @@ class FlightSQLServer : public arrow::flight::sql::FlightSqlServerBase {
41694169
}
41704170

41714171
private:
4172+
arrow::flight::FlightEndpoint create_endpoint(std::string ticket)
4173+
{
4174+
#if ARROW_VERSION_MAJOR >= 14
4175+
return arrow::flight::FlightEndpoint{
4176+
arrow::flight::Ticket{std::move(ticket)}, {}, std::nullopt, ""};
4177+
#elif ARROW_VERSION_MAJOR >= 13
4178+
return arrow::flight::FlightEndpoint{
4179+
arrow::flight::Ticket{std::move(ticket)}, {}, std::nullopt};
4180+
#else
4181+
return arrow::flight::FlightEndpoint
4182+
{
4183+
arrow::flight::Ticket{std::move(ticket), {}};
4184+
#endif
4185+
}
4186+
41724187
arrow::Result<uint64_t> session_id(const arrow::flight::ServerCallContext& context)
41734188
{
41744189
auto middleware = reinterpret_cast<HeaderAuthServerMiddleware*>(

0 commit comments

Comments
 (0)