Hi Team,
I have generated C# source for TCLIService using thrift, to connect to the
Hiveserver2, when I connect the hiveserver2 with Hive version 0.13,
TFetchResultsResp result is always returned in values of columns and not in
rows i.e. rows count always zero.
When I tried with the Hive version 0.12, TFetchResultsResp result is always
returned in rows and not in column i.e. column count always zero.
Please advise whether i need to set any property to fetch both columns and
rows in results in all the Hive versions.
TSocket transport = new TSocket("localhost", 10000);
TBinaryProtocol protocol = new TBinaryProtocol(transport);
TCLIService.Client client = new TCLIService.Client(protocol);
transport.Open();
TOpenSessionReq openReq = new TOpenSessionReq();
TOpenSessionResp openResp = client.OpenSession(openReq);
TSessionHandle sessHandle = openResp.SessionHandle;
TExecuteStatementReq execReq = new TExecuteStatementReq();
execReq.SessionHandle = sessHandle;
execReq.Statement = "show tables";
TExecuteStatementResp execResp = client.ExecuteStatement(execReq);
TOperationHandle stmtHandle = execResp.OperationHandle;
TFetchResultsReq fetchReq = new TFetchResultsReq();
fetchReq.OperationHandle = stmtHandle;
fetchReq.Orientation = TFetchOrientation.FETCH_FIRST;
fetchReq.MaxRows = 99999999;
TFetchResultsResp resultsResp = client.FetchResults(fetchReq);
TRowSet resultsSet = resultsResp.Results;
//In hive version 0.13, rows count zero
List<TRow> resultRows = resultsSet.Rows;
//In Hive version 0.12, columns count zero
List<TColumn> resultColumn = resultsSet.Columns;
TCloseOperationReq closeReq = new TCloseOperationReq();
closeReq.OperationHandle = stmtHandle;
client.CloseOperation(closeReq);
TCloseSessionReq closeConnectionReq = new TCloseSessionReq();
closeConnectionReq.SessionHandle = sessHandle;
client.CloseSession(closeConnectionReq);
transport.Close();
Thanks in advance.
Regards,
George