client.executeStatement(sessHandle, queryString, opConf); client.executeStatement(sessHandle, queryString, opConf); client.executeStatement(sessHandle, queryString, opConf); OperationHandle opHandle = client.executeStatement(sessHandle, queryString, opConf); assertNotNull(opHandle); client.executeStatement(sessHandle, queryString, opConf);
client.executeStatement(sessHandle, queryString, opConf); client.executeStatement(sessHandle, queryString, opConf); client.executeStatement(sessHandle, queryString, opConf); client.executeStatement(sessHandle, queryString, opConf);
client.executeStatement(sessHandle, queryString, opConf); client.executeStatement(sessHandle, queryString, opConf); client.executeStatement(sessHandle, queryString, opConf); OperationHandle opHandle = client.executeStatement(sessHandle, queryString, opConf); assertNotNull(opHandle); client.executeStatement(sessHandle, queryString, opConf);
private void verifyInitProperty(String key, String value, SessionHandle sessionHandle) throws Exception { OperationHandle operationHandle = client.executeStatement(sessionHandle, "set " + key, null); RowSet rowSet = client.fetchResults(operationHandle); Assert.assertEquals(1, rowSet.numRows()); // we know rowSet has only one element Assert.assertEquals(key + "=" + value, rowSet.iterator().next()[0]); client.closeOperation(operationHandle); } }
@Test // This is to test session temporary files are cleaned up after HIVE-11768 public 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()); }
public OperationHandle executeStatement(SessionHandle sessionHandle, String statement, Map<String, String> confOverlay) throws HiveSQLException { try (SessionStateContext ignored = new SessionStateContext()) { return super.executeStatement(sessionHandle, statement, confOverlay); } }
public OperationHandle executeStatement(SessionHandle sessionHandle, String statement, Map<String, String> confOverlay) throws HiveSQLException { try (SessionStateContext ignored = new SessionStateContext()) { return super.executeStatement(sessionHandle, statement, confOverlay); } }