Hi Junwang,

Thanks for trying this product!

Sorry, the example program has problems. Could you try this
patch?

----
diff --git a/example/flight-sql/query-prepared.cc 
b/example/flight-sql/query-prepared.cc
index 621b650..a3e1a87 100644
--- a/example/flight-sql/query-prepared.cc
+++ b/example/flight-sql/query-prepared.cc
@@ -128,7 +128,7 @@ run()
        ARROW_RETURN_NOT_OK(i_builder->Append(10));
        ARROW_ASSIGN_OR_RAISE(auto record_batch, record_batch_builder->Flush());
        ARROW_RETURN_NOT_OK(statement->SetParameters(record_batch));
-       ARROW_ASSIGN_OR_RAISE(auto info, statement->Execute());
+       ARROW_ASSIGN_OR_RAISE(auto info, statement->Execute(call_options));
        for (const auto& endpoint : info->endpoints())
        {
                ARROW_ASSIGN_OR_RAISE(auto reader,
@@ -143,7 +143,7 @@ run()
                        std::cout << chunk.data->ToString() << std::endl;
                }
        }
-       ARROW_RETURN_NOT_OK(statement->Close());
+       ARROW_RETURN_NOT_OK(statement->Close(call_options));
        return sql_client->Close();
 }
 // End query
----

Thanks,
-- 
kou

In <CAEG8a3JFkqPeMMioPMegQwciOfo=AO47THZG2S=890aja93...@mail.gmail.com>
  "Re: [ANNOUNCE] Apache Arrow Flight SQL adapter for PostgreSQL 0.1.0 
released" on Thu, 14 Sep 2023 14:31:32 +0800,
  Junwang Zhao <zhjw...@gmail.com> wrote:

> Hi Sutou,
> 
> On Thu, Sep 14, 2023 at 8:06 AM Sutou Kouhei <k...@apache.org> wrote:
>>
>> The Apache Arrow team is pleased to announce the 0.1.0 release of
>> the Apache Arrow Flight SQL adapter for PostgreSQL.
>>
>> The release is available now from our website:
>>   https://arrow.apache.org/flight-sql-postgresql/0.1.0/install.html
>>
>> Read about what's new in the release:
>>   
>> https://arrow.apache.org/blog/2023/09/13/flight-sql-postgresql-0.1.0-release/
>>
>> Release note:
>>   
>> https://arrow.apache.org/flight-sql-postgresql/0.1.0/release-notes.html#version-0-1-0
>>
>>
>> What is Apache Arrow Flight SQL adapter for PostgreSQL?
>>
>> Apache Arrow Flight SQL adapter for PostgreSQL is a
>> PostgreSQL extension that adds an Apache Arrow Flight SQL
>> endpoint to PostgreSQL.
>>
>> Apache Arrow Flight SQL is a protocol to use Apache Arrow
>> format to interact with SQL databases. You can use Apache
>> Arrow Flight SQL instead of the PostgreSQL wire protocol to
>> interact with PostgreSQL by Apache Arrow Flight SQL adapter
>> for PostgreSQL.
> 
> I tried the examples provide in the repo, authenticate-password and
> query-ad-hoc gives the right output, but query-prepared seems
> not working well with following error message:
> 
> /build/apache-arrow-13.0.0/cpp/src/arrow/flight/sql/client.cc:154:
> Failed to delete PreparedStatement: IOError: No authorization header.
> Detail: Unauthenticated. Detail: Unauthenticated
> IOError: No authorization header. Detail: Unauthenticated. gRPC client
> debug context: {"created":"@1694672534.441199175","description":"Error
> received from peer
> ipv4:127.0.0.1:15432","file":"/build/apache-arrow-13.0.0/cpp_build/grpc_ep-prefix/src/grpc_ep/src/core/lib/surface/call.cc","file_line":952,"grpc_message":"No
> authorization header. Detail: Unauthenticated","grpc_status":16}.
> Client context: OK. Detail: Unauthenticated
> 
> This error came from this line:
> 
> *ARROW_RETURN_NOT_OK(statement->SetParameters(record_batch));*
> 
> That is to say the authenticate logic in connect is ok, do we need
> some authorization header to address this error?
> 
>>
>> Apache Arrow format is designed for fast typed table data
>> exchange. If you want to get large data by SELECT or
>> INSERT/UPDATE large data, Apache Arrow Flight SQL will be
>> faster than the PostgreSQL wire protocol.
>>
>>
>> Please report any feedback to the GitHub issues or mailing lists:
>>   * GitHub: https://github.com/apache/arrow-flight-sql-postgresql/issues
>>   * ML: https://arrow.apache.org/community/
>>
>>
>> Thanks,
>> --
>> The Apache Arrow community
> 
> 
> 
> -- 
> Regards
> Junwang Zhao

Reply via email to