Search in sources :

Example 1 with EmbeddedThriftBinaryCLIService

use of org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService in project hive by apache.

the class TestSessionCleanup method testTempSessionFileCleanup.

@Test
public // This is to test session temporary files are cleaned up after HIVE-11768
void testTempSessionFileCleanup() throws Exception {
    EmbeddedThriftBinaryCLIService service = new EmbeddedThriftBinaryCLIService();
    HiveConf hiveConf = new HiveConf();
    hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    service.init(hiveConf);
    ThriftCLIServiceClient client = new ThriftCLIServiceClient(service);
    Set<String> existingPipeoutFiles = new HashSet<String>(Arrays.asList(getPipeoutFiles()));
    SessionHandle sessionHandle = client.openSession("user1", "foobar", Collections.<String, String>emptyMap());
    client.executeStatement(sessionHandle, "set a=b", null);
    File operationLogRootDir = new File(new HiveConf().getVar(ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LOG_LOCATION));
    Assert.assertNotEquals(operationLogRootDir.list().length, 0);
    client.closeSession(sessionHandle);
    // Check if session files are removed
    Assert.assertEquals(operationLogRootDir.list().length, 0);
    // Check if the pipeout files are removed
    Set<String> finalPipeoutFiles = new HashSet<String>(Arrays.asList(getPipeoutFiles()));
    finalPipeoutFiles.removeAll(existingPipeoutFiles);
    Assert.assertTrue(finalPipeoutFiles.isEmpty());
}
Also used : EmbeddedThriftBinaryCLIService(org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService) HiveConf(org.apache.hadoop.hive.conf.HiveConf) SessionHandle(org.apache.hive.service.cli.SessionHandle) File(java.io.File) ThriftCLIServiceClient(org.apache.hive.service.cli.thrift.ThriftCLIServiceClient) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with EmbeddedThriftBinaryCLIService

use of org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService in project hive by apache.

the class TestEmbeddedThriftBinaryCLIService method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    service = new EmbeddedThriftBinaryCLIService();
    HiveConf conf = new HiveConf();
    conf.setBoolean("datanucleus.schema.autoCreateTables", true);
    conf.setVar(HiveConf.ConfVars.HIVEMAPREDMODE, "nonstrict");
    service.init(conf);
    client = new ThriftCLIServiceClient(service);
}
Also used : EmbeddedThriftBinaryCLIService(org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService) HiveConf(org.apache.hadoop.hive.conf.HiveConf) ThriftCLIServiceClient(org.apache.hive.service.cli.thrift.ThriftCLIServiceClient) BeforeClass(org.junit.BeforeClass)

Example 3 with EmbeddedThriftBinaryCLIService

use of org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService in project hive by apache.

the class TestSessionHooks method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    SessionHookTest.runCount.set(0);
    System.setProperty(ConfVars.HIVE_SERVER2_SESSION_HOOK.varname, TestSessionHooks.SessionHookTest.class.getName());
    service = new EmbeddedThriftBinaryCLIService();
    HiveConf hiveConf = new HiveConf();
    hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    service.init(hiveConf);
    client = new ThriftCLIServiceClient(service);
}
Also used : EmbeddedThriftBinaryCLIService(org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService) HiveConf(org.apache.hadoop.hive.conf.HiveConf) ThriftCLIServiceClient(org.apache.hive.service.cli.thrift.ThriftCLIServiceClient) Before(org.junit.Before)

Aggregations

HiveConf (org.apache.hadoop.hive.conf.HiveConf)3 EmbeddedThriftBinaryCLIService (org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService)3 ThriftCLIServiceClient (org.apache.hive.service.cli.thrift.ThriftCLIServiceClient)3 File (java.io.File)1 HashSet (java.util.HashSet)1 SessionHandle (org.apache.hive.service.cli.SessionHandle)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1