gpt4 book ai didi

hadoop - TApplicationException : Required field 'client_protocol' is unset

转载 作者:行者123 更新时间:2023-12-02 21:44:49 24 4
gpt4 key购买 nike

我正在开发一个节俭的客户,

我已经在我的机器上构建了一个节俭的配置单元服务器(apache-hive-0.14.0),并且还可以访问 Cloudera Dist Hive 4.6.0

当我将 Thrift 客户端连接到 CDH 客户端时,会出现以下错误:

TApplicationException: Required field 'client_protocol' is unset!
Struct:TOpenSessionReq(client_protocol:null, username:

我正在将正确的协议(protocol)传递给服务器,但似乎有些事情已经过时了......

此外,如果我指向本地主机(我运行配置单元服务器的地方),一切似乎都运行良好......

请让我知道这里出了什么问题....

代码:

       var socket = new TSocket("XXX.XXX.XXX.XXX", 10000);

TStreamTransport sTransport = (TStreamTransport)socket;

var transport = new TBufferedTransport(socket);

underlyingTransport = transport;

var proto = new TBinaryProtocol(transport);
var client = new TCLIService.Client(proto);
transport.Open();

TOpenSessionReq req = new TOpenSessionReq(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6);
req.Username = "hive";
req.Password = "hive";

TOpenSessionResp oSResponse = client.OpenSession(req);
TSessionHandle sessionHandle = oSResponse.SessionHandle;

TExecuteStatementReq execReq = new TExecuteStatementReq(sessionHandle, "select * from emp");
TExecuteStatementResp exeRes= client.ExecuteStatement(execReq);
TOperationHandle operationHandle = exeRes.OperationHandle;

TFetchResultsReq fechReq = new TFetchResultsReq(operationHandle,TFetchOrientation.FETCH_FIRST, 1);
TFetchResultsResp fechRes = client.FetchResults(fechReq);

TRowSet results = fechRes.Results;
List<TRow> resultRows = results.Rows;
foreach (var row in resultRows)
{
var val = row.ColVals[0];
System.Console.WriteLine(val.StringVal);
}

TCloseOperationReq closeOprReq = new TCloseOperationReq(operationHandle);
client.CloseOperation(closeOprReq);

TCloseSessionReq creq = new TCloseSessionReq(sessionHandle);
client.CloseSession(creq);

最佳答案

我相信这是 hive-jdbc 版本的问题。此解决方案可能会解决您的问题:Required field 'client_protocol' is unset

关于hadoop - TApplicationException : Required field 'client_protocol' is unset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26300643/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com