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 <georgeli2...@gmail.com<mailto:georgeli2...@gmail.com>>
Reply-To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Date: Wednesday, January 28, 2015 at 2:35 AM
To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@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

Reply via email to