You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by George Livingston <ge...@gmail.com> on 2015/01/28 11:35:12 UTC
tfetchresultsresp row returns zero
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
Re: tfetchresultsresp row returns zero
Posted by George Livingston <ge...@gmail.com>.
Hi Vaibhav,
Thank you so much, it was very helpful for me.
Regards,
George
On Thu, Jan 29, 2015 at 12:36 AM, Vaibhav Gumashta <
vgumashta@hortonworks.com> wrote:
> Hi George,
>
> This was done as part of https://issues.apache.org/jira/browse/HIVE-3746.
> The reason was that the previous serialization design (row major) was very
> inefficient and resulted in a lot of unnecessary network traffic. The
> current design (column major) addresses some of those issues.
>
> Thanks,
> —Vaibhav
>
>
> From: George Livingston <ge...@gmail.com>
> Reply-To: "user@hive.apache.org" <us...@hive.apache.org>
> Date: Wednesday, January 28, 2015 at 2:35 AM
> To: "user@hive.apache.org" <us...@hive.apache.org>
> Subject: tfetchresultsresp row returns zero
>
> 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
>
Re: tfetchresultsresp row returns zero
Posted by Vaibhav Gumashta <vg...@hortonworks.com>.
Hi George,
This was done as part of https://issues.apache.org/jira/browse/HIVE-3746. The reason was that the previous serialization design (row major) was very inefficient and resulted in a lot of unnecessary network traffic. The current design (column major) addresses some of those issues.
Thanks,
-Vaibhav
From: George Livingston <ge...@gmail.com>>
Reply-To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Date: Wednesday, January 28, 2015 at 2:35 AM
To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Subject: tfetchresultsresp row returns zero
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