private void createTestTable(String tableName, String columnDefinitions, Map<String, String> confOverlay, SessionHandle sessionHandle) throws HiveSQLException { String queryString; // Drop the table if it exists queryString = "DROP TABLE IF EXISTS " + tableName; client.executeStatement(sessionHandle, queryString, confOverlay); // Create a test table queryString = "CREATE TABLE " + tableName + columnDefinitions; client.executeStatement(sessionHandle, queryString, confOverlay); }
opHandle = client.executeStatement(sessionHandle, queryString, confOverlay); client.closeOperation(opHandle); client.executeStatement(sessionHandle, queryString, confOverlay); client.closeSession(sessionHandle);
private SessionHandle openSession(Map<String, String> confOverlay) throws HiveSQLException { SessionHandle sessionHandle = client.openSession("tom", "password", confOverlay); assertNotNull(sessionHandle); SessionState.get().setIsHiveServerQuery(true); // Pretend we are in HS2. String queryString = "SET " + HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname + " = false"; client.executeStatement(sessionHandle, queryString, confOverlay); return sessionHandle; }
client.executeStatement(sessionHandle, "DROP TABLE " + tableName, confOverlay); client.closeSession(sessionHandle);
opHandle = client.executeStatement(sessionHandle, queryString, confOverlay); client.closeOperation(opHandle); opHandle = client.executeStatement(sessionHandle, queryString, confOverlay); client.closeOperation(opHandle); opHandle = client.executeStatement(sessionHandle, queryString, confOverlay); client.closeOperation(opHandle); opHandle = client.executeStatement(sessionHandle, queryString, confOverlay); opHandle = client.executeStatement(sessionHandle, queryString, confOverlay); client.closeOperation(opHandle); client.closeSession(sessionHandle);
client.executeStatement(sessionHandle, "DROP TABLE " + tableName, getConfOverlay(0, longPollingTimeoutMs)); client.closeSession(sessionHandle);
OperationHandle opHandle = client.executeStatement(sessionHandle, setLockMgr, null); client.closeOperation(opHandle); opHandle = client.executeStatement(sessionHandle, dropTable, null); client.closeOperation(opHandle); opHandle = client.executeStatement(sessionHandle, createTab, confOverlay); assertNotNull(opHandle); opHandle = client.executeStatement(sessionHandle, selectTab, null); assertNotNull(opHandle); opHandle = client.executeStatement(sessionHandle, selectTab, null); fail("Query should fail"); } catch (HiveSQLException e) { opHandle = client.executeStatement(sessionHandle, dropTable, null); client.closeOperation(opHandle); client.closeSession(sessionHandle);
qdconf.set("mapred.job.name", ctx.getQueryHandle().toString()); SessionHandle sessionHandle = getSession(ctx); op = getClient().executeStatement(sessionHandle, ctx.getSelectedDriverQuery(), qdconf.getValByRegex(".*")); log.info("The hive operation handle: {}", op); ctx.setDriverOpHandle(op.toString());
qdconf.set("mapred.job.name", ctx.getQueryHandle().toString()); SessionHandle sessionHandle = getSession(ctx); op = getClient().executeStatement(sessionHandle, ctx.getSelectedDriverQuery(), qdconf.getValByRegex(".*")); log.info("The hive operation handle: {}", op); ctx.setDriverOpHandle(op.toString());