我们正在尝试使用 Apache Arrow Flight C# 客户端连接到 dremio 服务。我们在以下链接中找不到任何工作代码示例:
https://github.com/dremio-hub/arrow-flight-client-examples
https://github.com/apache/arrow/tree/master/csharp/examples
我们尝试使用以下 c# 代码从对我们有用的箭头飞行客户端连接到 dremio:
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding(“ISO-8859-1”).GetBytes(“user_name” + “:” + “password”));
var credentials = CallCredentials.FromInterceptor((context, metadata) =>
{
metadata.Add(“Authorization”, "Basic " + encoded);
return Task.CompletedTask;
});
GrpcChannel channel = GrpcChannel.ForAddress(“dremio_url”, new GrpcChannelOptions
{
Credentials = ChannelCredentials.Create(new SslCredentials(), credentials)
});
FlightClient client = new FlightClient(channel);
client.ListActions();
while (await actions.ResponseStream.MoveNext(default))
{
Console.WriteLine(actions.ResponseStream.Current);
}
运行上述代码时,我们遇到以下异常:
[2021-10-15T06:14:56.704Z] System.Private.CoreLib:执行函数时出现异常:ExtractData。Grpc.Net.Client: Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. IOException: The handshake failed due to an unexpected packet format.", DebugException="System.Net.Http.HttpRequestException:无法建立 SSL 连接,请参见内部异常。[2021-10-15T06:14:56.721Z] ---> System.IO.IOException:握手失败,原因是意外的数据包格式。[2021-10-15T06:14:56.734Z] 在 System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) [2021-10-15T06:14:56.772Z ] 在 System.Net.Security.SslStream。
非常感谢解决此代码示例中的问题的任何帮助。