Search in sources :

Example 6 with TStatus

use of org.apache.hive.service.rpc.thrift.TStatus in project hive by apache.

the class TestHiveSQLException method testHiveSQLExceptionToTStatus.

/**
 * Tests the conversion from a HiveSQLException exception to the TStatus object
 */
@Test
public void testHiveSQLExceptionToTStatus() {
    String expectedMessage = "reason";
    String expectedSqlState = "sqlState";
    int expectedVendorCode = 10;
    Exception ex1 = new HiveSQLException(expectedMessage, expectedSqlState, expectedVendorCode, createSimpleCause());
    TStatus status = HiveSQLException.toTStatus(ex1);
    Assert.assertEquals(TStatusCode.ERROR_STATUS, status.getStatusCode());
    Assert.assertEquals(expectedSqlState, status.getSqlState());
    Assert.assertEquals(expectedMessage, status.getErrorMessage());
    Assert.assertEquals(HiveSQLException.toString(ex1), status.getInfoMessages());
}
Also used : TStatus(org.apache.hive.service.rpc.thrift.TStatus) Test(org.junit.Test)

Aggregations

TStatus (org.apache.hive.service.rpc.thrift.TStatus)6 Test (org.junit.Test)2 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)1 SessionHandle (org.apache.hive.service.cli.SessionHandle)1 TGetDelegationTokenResp (org.apache.hive.service.rpc.thrift.TGetDelegationTokenResp)1