Search in sources :

Example 26 with RowSet

use of org.apache.hive.service.cli.RowSet in project hive by apache.

the class OperationLoggingAPITestBase method testFetchResultsOfLogWithNoneMode.

@Test
public void testFetchResultsOfLogWithNoneMode() throws Exception {
    try {
        String queryString = "set hive.server2.logging.operation.level=none";
        client.executeStatement(sessionHandle, queryString, null);
        // verify whether the sql operation log is generated and fetch correctly.
        OperationHandle operationHandle = client.executeStatement(sessionHandle, sqlCntStar, null);
        RowSet rowSetLog = client.fetchResults(operationHandle, FetchOrientation.FETCH_FIRST, 1000, FetchType.LOG);
        // We should not get any rows.
        assert (rowSetLog.numRows() == 0);
    } finally {
        // Restore everything to default setup to avoid discrepancy between junit test runs
        String queryString2 = "set hive.server2.logging.operation.level=verbose";
        client.executeStatement(sessionHandle, queryString2, null);
    }
}
Also used : RowSet(org.apache.hive.service.cli.RowSet) OperationHandle(org.apache.hive.service.cli.OperationHandle) Test(org.junit.Test)

Example 27 with RowSet

use of org.apache.hive.service.cli.RowSet in project hive by apache.

the class OperationLoggingAPITestBase method testFetchResultsOfLogWithVerboseMode.

@Test
public void testFetchResultsOfLogWithVerboseMode() throws Exception {
    String queryString = "set hive.server2.logging.operation.level=verbose";
    client.executeStatement(sessionHandle, queryString, null);
    // verify whether the sql operation log is generated and fetch correctly.
    OperationHandle operationHandle = client.executeStatement(sessionHandle, sqlCntStar, null);
    RowSet rowSetLog = client.fetchResults(operationHandle, FetchOrientation.FETCH_FIRST, 1000, FetchType.LOG);
    // Verbose Logs should contain everything, including execution and performance
    verifyFetchedLog(rowSetLog, expectedLogsVerbose);
    verifyFetchedLog(rowSetLog, expectedLogsExecution);
    verifyFetchedLog(rowSetLog, expectedLogsPerformance);
}
Also used : RowSet(org.apache.hive.service.cli.RowSet) OperationHandle(org.apache.hive.service.cli.OperationHandle) Test(org.junit.Test)

Aggregations

RowSet (org.apache.hive.service.cli.RowSet)27 OperationHandle (org.apache.hive.service.cli.OperationHandle)21 Test (org.junit.Test)14 SessionHandle (org.apache.hive.service.cli.SessionHandle)8 CLIServiceClient (org.apache.hive.service.cli.CLIServiceClient)5 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)5 SQLException (java.sql.SQLException)3 ArrayList (java.util.ArrayList)3 QueryResult (co.cask.cdap.proto.QueryResult)2 ImmutableList (com.google.common.collect.ImmutableList)2 LogDivertAppenderForTest (org.apache.hadoop.hive.ql.log.LogDivertAppenderForTest)2 TFetchResultsResp (org.apache.hive.service.rpc.thrift.TFetchResultsResp)2 TException (org.apache.thrift.TException)2 File (java.io.File)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Method (java.lang.reflect.Method)1 UnknownHostException (java.net.UnknownHostException)1 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)1 SQLTimeoutException (java.sql.SQLTimeoutException)1