This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/arrow-flight-sql-postgresql.git


The following commit(s) were added to refs/heads/main by this push:
     new cfcebea  Add support for Apache Arrow C++ 13.0.0 or later (#194)
cfcebea is described below

commit cfcebea812943a65518d1f227ca592fd42f3d50c
Author: Sutou Kouhei <[email protected]>
AuthorDate: Wed Jan 1 12:28:32 2025 +0900

    Add support for Apache Arrow C++ 13.0.0 or later (#194)
    
    Closes GH-193
---
 src/afs.cc | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/afs.cc b/src/afs.cc
index 2d77798..37f5bab 100644
--- a/src/afs.cc
+++ b/src/afs.cc
@@ -4083,7 +4083,7 @@ class FlightSQLServer : public 
arrow::flight::sql::FlightSqlServerBase {
                ARROW_ASSIGN_OR_RAISE(auto ticket,
                                      
arrow::flight::sql::CreateStatementQueryTicket(query));
                std::vector<arrow::flight::FlightEndpoint> endpoints{
-                       
arrow::flight::FlightEndpoint{arrow::flight::Ticket{std::move(ticket)}, {}}};
+                       create_endpoint(std::move(ticket))};
                ARROW_ASSIGN_OR_RAISE(
                        auto result,
                        arrow::flight::FlightInfo::Make(*schema, descriptor, 
endpoints, -1, -1));
@@ -4140,7 +4140,7 @@ class FlightSQLServer : public 
arrow::flight::sql::FlightSqlServerBase {
                ARROW_ASSIGN_OR_RAISE(auto ticket,
                                      
arrow::flight::sql::CreateStatementQueryTicket(handle));
                std::vector<arrow::flight::FlightEndpoint> endpoints{
-                       
arrow::flight::FlightEndpoint{arrow::flight::Ticket{std::move(ticket)}, {}}};
+                       create_endpoint(std::move(ticket))};
                ARROW_ASSIGN_OR_RAISE(
                        auto result,
                        arrow::flight::FlightInfo::Make(*schema, descriptor, 
endpoints, -1, -1));
@@ -4169,6 +4169,21 @@ class FlightSQLServer : public 
arrow::flight::sql::FlightSqlServerBase {
        }
 
    private:
+       arrow::flight::FlightEndpoint create_endpoint(std::string ticket)
+       {
+#if ARROW_VERSION_MAJOR >= 14
+               return arrow::flight::FlightEndpoint{
+                       arrow::flight::Ticket{std::move(ticket)}, {}, 
std::nullopt, ""};
+#elif ARROW_VERSION_MAJOR >= 13
+               return arrow::flight::FlightEndpoint{
+                       arrow::flight::Ticket{std::move(ticket)}, {}, 
std::nullopt};
+#else
+               return arrow::flight::FlightEndpoint
+               {
+                       arrow::flight::Ticket{std::move(ticket), {}};
+#endif
+       }
+
        arrow::Result<uint64_t> session_id(const 
arrow::flight::ServerCallContext& context)
        {
                auto middleware = reinterpret_cast<HeaderAuthServerMiddleware*>(

Reply via email to