private void checkInterrupted(String msg, HookContext hookContext, PerfLogger perfLogger) throws CommandProcessorResponse { if (lDrvState.isAborted()) { throw createProcessorResponse(handleInterruptionWithHook(msg, hookContext, perfLogger)); } }
public Driver(QueryState queryState, String userName, QueryInfo queryInfo, HiveTxnManager txnMgr) { this.queryState = queryState; this.conf = queryState.getConf(); this.userName = userName; this.hookRunner = new HookRunner(conf, console); this.queryInfo = queryInfo; this.initTxnMgr = txnMgr; }
/** * @return col stats */ public Map<String, ColumnStatsList> getColStatsCache() { return ctx.getOpContext().getColStatsCache(); }
@Override public Schema getSchema() { if(explainReOptimization) { return coreDriver.getExplainSchema(); } return coreDriver.getSchema(); }
@Override public CommandProcessorResponse compileAndRespond(String statement) { currentQuery = statement; return coreDriver.compileAndRespond(statement); }
public HiveTxnManager getTxnMgr() { return driverContext.getCtx().getHiveTxnManager(); } }
public void init(QueryState queryState, LogHelper console, Hive db) { this.queryState = queryState; this.conf = queryState.getConf(); this.db = db; this.console = console; }
/** * Compile a new query. Any currently-planned query associated with this Driver is discarded. * Do not reset id for inner queries(index, etc). Task ids are used for task identity check. * * @param command * The SQL query to compile. */ @Override public int compile(String command) { return compile(command, true); }
private void setTriggerContext(final String queryId) { final long queryStartTime; // query info is created by SQLOperation which will have start time of the operation. When JDBC Statement is not // used queryInfo will be null, in which case we take creation of Driver instance as query start time (which is also // the time when query display object is created) if (queryInfo != null) { queryStartTime = queryInfo.getBeginTime(); } else { queryStartTime = queryDisplay.getQueryStartTime(); } WmContext wmContext = new WmContext(queryStartTime, queryId); ctx.setWmContext(wmContext); }
/** * This is the recommended constructor to use since it helps use * canonical messages throughout and propagate remote errors. * * @param errorMsg Canonical error message * @param msgArgs message arguments if message is parametrized; must be {@code null} is message takes no arguments */ public DataConstraintViolationError(Throwable cause, ErrorMsg errorMsg, String... msgArgs) { super(errorMsg.format(msgArgs), cause); canonicalErrorMsg = errorMsg; }
/** * Release some resources after a query is executed * while keeping the result around. */ public void releaseResources() { releasePlan(); releaseDriverContext(); }
/** * Create a temporary directory depending of the path specified. * - If path is an Object store filesystem, then use the default MR scratch directory (HDFS) * - If path is on HDFS, then create a staging directory inside the path * * @param path Path used to verify the Filesystem to use for temporary directory * @return A path to the new temporary directory */ public Path getTempDirForFinalJobPath(Path path) { return getExtTmpPathRelTo(path); }
protected void dropTables() throws Exception { super.dropTables(); for(TestTxnCommandsForMmTable.TableExtended t : TestTxnCommandsForMmTable.TableExtended.values()) { runStatementOnDriver("drop table if exists " + t); } } /**
/** * We have to use a different query to check results for Vectorized tests because to get the * file name info we need to use {@link org.apache.hadoop.hive.ql.metadata.VirtualColumn#FILENAME} * which will currently make the query non-vectorizable. This means we can't check the file name * for vectorized version of the test. */ protected void checkResult(String[][] expectedResult, String query, boolean isVectorized, String msg, Logger LOG) throws Exception{ List<String> rs = runStatementOnDriver(query); checkExpected(rs, expectedResult, msg + (isVectorized ? " vect" : ""), LOG, !isVectorized); assertVectorized(isVectorized, query); } void dropTable(String[] tabs) throws Exception {
protected void updateStatusInQueryDisplay() { if (queryDisplay != null) { queryDisplay.updateTaskStatus(this); } }
@Override protected LockedDriverState initialValue() { return new LockedDriverState(); } };
protected void dropTables() throws Exception { for(TxnCommandsBaseForTests.Table t : TxnCommandsBaseForTests.Table.values()) { runStatementOnDriver("drop table if exists " + t); } } @After
protected void dropTables() throws Exception { for(Table t : Table.values()) { runStatementOnDriver("drop table if exists " + t); } } @After
void checkResult(String[][] expectedResult, String query, boolean isVectorized, String msg) throws Exception{ checkResult(expectedResult, query, isVectorized, msg, LOG); } @Test
/** * Dump all data in the table by bucket in JSON format */ private void dumpTableData(Table table, long writeId, int stmtId) throws Exception { for(int bucketNum = 0; bucketNum < BUCKET_COUNT; bucketNum++) { dumpBucketData(table, writeId, stmtId, bucketNum); } } @Test