/** * Release some resources after a query is executed * while keeping the result around. */ private void releaseResources() { releasePlan(); releaseDriverContext(); if (SessionState.get() != null) { SessionState.get().getLineageState().clear(); } }
public HookContext(QueryPlan queryPlan, QueryState queryState, Map<String, ContentSummary> inputPathToContentSummary, String userName, String ipAddress, String hiveInstanceAddress, String operationId, String sessionId, String threadId, boolean isHiveServerQuery, PerfLogger perfLogger) throws Exception { this.queryPlan = queryPlan; this.queryState = queryState; this.conf = queryState.getConf(); this.inputPathToContentSummary = inputPathToContentSummary; completeTaskList = new ArrayList<TaskRunner>(); inputs = queryPlan.getInputs(); outputs = queryPlan.getOutputs(); ugi = Utils.getUGI(); linfo= null; depMap = null; if(SessionState.get() != null){ linfo = SessionState.get().getLineageState().getLineageInfo(); depMap = SessionState.get().getLineageState().getIndex(); } this.userName = userName; this.ipAddress = ipAddress; this.hiveInstanceAddress = hiveInstanceAddress; this.operationId = operationId; this.sessionId = sessionId; this.threadId = threadId; this.isHiveServerQuery = isHiveServerQuery; this.perfLogger = perfLogger; }
public int close() { lDrvState.stateLock.lock(); try { releaseDriverContext(); if (lDrvState.driverState == DriverState.COMPILING || lDrvState.driverState == DriverState.EXECUTING || lDrvState.driverState == DriverState.INTERRUPT) { lDrvState.driverState = DriverState.INTERRUPT; return 0; } releasePlan(); releaseFetchTask(); releaseResStream(); releaseContext(); lDrvState.driverState = DriverState.CLOSED; } finally { lDrvState.stateLock.unlock(); } if (SessionState.get() != null) { SessionState.get().getLineageState().clear(); } return 0; }
private int closeInProcess(boolean destroyed) { releaseDriverContext(); releasePlan(); releaseFetchTask(); releaseResStream(); releaseContext(); if (SessionState.get() != null) { SessionState.get().getLineageState().clear(); } if(destroyed) { if (!hiveLocks.isEmpty()) { try { releaseLocksAndCommitOrRollback(false, null); } catch (LockException e) { LOG.warn("Exception when releasing locking in destroy: " + e.getMessage()); } } ShutdownHookManager.removeShutdownHook(shutdownRunner); } return 0; }
SessionState.get().getLineageState().getIndex() : new Index();
SessionState.get().getLineageState() .mapDirToOp(new Path(createVwDesc.getViewName()), sinkOp);
work.getLoadTableWork().getWriteType() != AcidUtils.Operation.DELETE && work.getLoadTableWork().getWriteType() != AcidUtils.Operation.UPDATE) { SessionState.get().getLineageState().setLineage(tbd.getSourcePath(), dc, table.getCols()); break; SessionState.get().getLineageState().setLineage(tbd.getSourcePath(), dc, tableCols);
SessionState.get().getLineageState() .mapDirToOp(ltd.getSourcePath(), (FileSinkOperator) output); } else if ( queryState.getCommandType().equals(HiveOperation.CREATETABLE_AS_SELECT.getOperationName())) { SessionState.get().getLineageState() .mapDirToOp(tlocation, (FileSinkOperator) output);
(SessionState.get() != null ? SessionState.get().getLineageState().getLineageInfo() : null), Utils.getUGI());
Table createdTable = db.getTable(tbl.getDbName(), tbl.getTableName()); DataContainer dc = new DataContainer(createdTable.getTTable()); SessionState.get().getLineageState().setLineage( createdTable.getPath(), dc, createdTable.getCols() );
SessionState.get().getLineageState().setLineage(new Path(crtView.getViewName()), dc, tbl.getCols());
public HookContext(QueryPlan queryPlan, HiveConf conf) throws Exception{ this.queryPlan = queryPlan; this.conf = conf; completeTaskList = new ArrayList<TaskRunner>(); inputs = queryPlan.getInputs(); outputs = queryPlan.getOutputs(); ugi = ShimLoader.getHadoopShims().getUGIForConf(conf); linfo= null; if(SessionState.get() != null){ linfo = SessionState.get().getLineageState().getLineageInfo(); } }
public HookContext(QueryPlan queryPlan, HiveConf conf, Map<String, ContentSummary> inputPathToContentSummary, String userName, String ipAddress, String operationId) throws Exception { this.queryPlan = queryPlan; this.conf = conf; this.inputPathToContentSummary = inputPathToContentSummary; completeTaskList = new ArrayList<TaskRunner>(); inputs = queryPlan.getInputs(); outputs = queryPlan.getOutputs(); ugi = Utils.getUGI(); linfo= null; if(SessionState.get() != null){ linfo = SessionState.get().getLineageState().getLineageInfo(); } this.userName = userName; this.ipAddress = ipAddress; this.operationId = operationId; }
@Override public ParseContext transform(ParseContext pctx) throws SemanticException { // Create the lineage context LineageCtx lCtx = new LineageCtx(pctx); Map<Rule, NodeProcessor> opRules = new LinkedHashMap<Rule, NodeProcessor>(); opRules.put(new RuleRegExp("R1", "TS%"), OpProcFactory.getTSProc()); opRules.put(new RuleRegExp("R2", "SCR%"), OpProcFactory.getTransformProc()); opRules.put(new RuleRegExp("R3", "UDTF%"), OpProcFactory.getTransformProc()); opRules.put(new RuleRegExp("R4", "SEL%"), OpProcFactory.getSelProc()); opRules.put(new RuleRegExp("R5", "GBY%"), OpProcFactory.getGroupByProc()); opRules.put(new RuleRegExp("R6", "UNION%"), OpProcFactory.getUnionProc()); opRules.put(new RuleRegExp("R7", "JOIN%|MAPJOIN%"), OpProcFactory.getJoinProc()); opRules.put(new RuleRegExp("R8", "RS%"), OpProcFactory.getReduceSinkProc()); opRules.put(new RuleRegExp("R9", "LVJ%"), OpProcFactory.getLateralViewJoinProc()); // The dispatcher fires the processor corresponding to the closest matching rule and passes the context along Dispatcher disp = new DefaultRuleDispatcher(OpProcFactory.getDefaultProc(), opRules, lCtx); GraphWalker ogw = new PreOrderWalker(disp); // Create a list of topop nodes ArrayList<Node> topNodes = new ArrayList<Node>(); topNodes.addAll(pctx.getTopOps().values()); ogw.startWalking(topNodes, null); // Transfer the index from the lineage context to the session state. if (SessionState.get() != null) { SessionState.get().getLineageState().setIndex(lCtx.getIndex()); } return pctx; }
SessionState.get().getLineageState().setIndex(lCtx.getIndex());
SessionState.get().getLineageState().setLineage(tbd.getSourceDir(), dc, table.getCols()); SessionState.get().getLineageState().setLineage(tbd.getSourceDir(), dc, table.getCols());
work.getLoadTableWork().getWriteType() != AcidUtils.Operation.DELETE && work.getLoadTableWork().getWriteType() != AcidUtils.Operation.UPDATE) { SessionState.get().getLineageState().setLineage(tbd.getSourcePath(), dc, table.getCols()); break; SessionState.get().getLineageState().setLineage(tbd.getSourcePath(), dc, tableCols);
SessionState.get().getLineageState() .mapDirToFop(ltd.getSourceDir(), (FileSinkOperator)output);
} else if (peh instanceof PostExecute) { ((PostExecute) peh).run(SessionState.get(), plan.getInputs(), plan.getOutputs(), (SessionState.get() != null ? SessionState.get().getLineageState().getLineageInfo() : null), ShimLoader.getHadoopShims().getUGIForConf(conf));
(SessionState.get() != null ? SessionState.get().getLineageState().getLineageInfo() : null), Utils.getUGI()); SessionState.get().getLineageState().clear(); SessionState.get().getHiveHistory().logPlanProgress(plan); } catch (Exception e) {