public static void stopScriptExecutors(EvalContext evalContext) { for (TajoScriptEngine executor : evalContext.getAllScriptEngines()) { executor.shutdown(); } }
@Override public EvalNode bind(EvalContext evalContext, Schema schema) { super.bind(evalContext, schema); try { this.funcInvoke = FunctionInvoke.newInstance(funcDesc); if (evalContext != null) { if (evalContext.hasScriptEngine(this)) { this.invokeContext.setScriptEngine(evalContext.getScriptEngine(this)); } if (evalContext.hasTimeZone()) { this.invokeContext.setTimeZone(evalContext.getTimeZone()); } } this.funcInvoke.init(invokeContext); } catch (IOException e) { throw new RuntimeException(e); } return this; }
@Override public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, UnaryEval unaryEval, Stack<EvalNode> stack) { stack.push(unaryEval); EvalNode child = visit(context, unaryEval.getChild(), stack); stack.pop(); unaryEval.setChild(child); if (child.getType() == EvalType.CONST) { // session's time zone String timezoneId = context.getQueryContext().get(SessionVars.TIMEZONE); EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId)); unaryEval.bind(evalContext, null); return new ConstEval(unaryEval.eval(null)); } return unaryEval; }
EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId)); try { executor.start(context.getQueryContext().getConf()); evalContext.addScriptEngine(evalNode, executor); evalNode.bind(evalContext, null); Datum funcRes = evalNode.eval(null);
public TaskAttemptContext(QueryContext queryContext, final ExecutionBlockContext executionBlockContext, final TaskAttemptId taskId, final FragmentProto[] fragments, final Path workDir) { this.queryContext = queryContext; if (executionBlockContext != null) { // For unit tests this.workerContext = executionBlockContext.getWorkerContext(); this.sharedResource = executionBlockContext.getSharedResource(); } this.taskId = taskId; if (fragments != null) { for (FragmentProto t : fragments) { if (fragmentMap.containsKey(t.getId())) { fragmentMap.get(t.getId()).add(t); } else { List<FragmentProto> frags = new ArrayList<>(); frags.add(t); fragmentMap.put(t.getId(), frags); } } } this.workDir = workDir; this.shuffleFileOutputs = Maps.newHashMap(); this.state = TaskAttemptState.TA_PENDING; this.partitionOutputVolume = Maps.newHashMap(); this.partitions = new ArrayList<>(); // set to system timezone for forwarded query this.evalContext.setTimeZone(queryContext.getConf().getSystemTimezone()); }
public static void startScriptExecutors(QueryContext queryContext, EvalContext evalContext, Target[] targets) throws IOException { for (int i = 0; i < targets.length; i++) { EvalNode eval = targets[i].getEvalTree(); if (eval instanceof GeneralFunctionEval) { GeneralFunctionEval functionEval = (GeneralFunctionEval) eval; if (functionEval.getFuncDesc().getInvocation().hasPython()) { TajoScriptEngine scriptExecutor = new PythonScriptEngine(functionEval.getFuncDesc()); evalContext.addScriptEngine(eval, scriptExecutor); scriptExecutor.start(queryContext.getConf()); } } } }
@Override public EvalNode bind(EvalContext evalContext, Schema schema) { super.bind(evalContext, schema); try { if (evalContext != null && evalContext.hasScriptEngine(this)) { this.invokeContext.setScriptEngine(evalContext.getScriptEngine(this)); this.invokeContext.getScriptEngine().setFirstPhase(firstPhase); this.invokeContext.getScriptEngine().setLastPhase(lastPhase); } this.functionInvoke.init(invokeContext); } catch (IOException e) { throw new RuntimeException(e); } return this; }
@Override public EvalNode bind(@Nullable EvalContext evalContext, Schema schema) { if (evalContext != null) { timezone = evalContext.getTimeZone(); } return super.bind(evalContext, schema); }
@Override public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, UnaryEval unaryEval, Stack<EvalNode> stack) { stack.push(unaryEval); EvalNode child = visit(context, unaryEval.getChild(), stack); stack.pop(); unaryEval.setChild(child); if (child.getType() == EvalType.CONST) { // session's time zone String timezoneId = context.getQueryContext().get(SessionVars.TIMEZONE); EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId)); unaryEval.bind(evalContext, null); return new ConstEval(unaryEval.eval(null)); } return unaryEval; }
EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId)); try { executor.start(context.getQueryContext().getConf()); evalContext.addScriptEngine(evalNode, executor); evalNode.bind(evalContext, null); Datum funcRes = evalNode.eval(null);
public TaskAttemptContext(QueryContext queryContext, final ExecutionBlockContext executionBlockContext, final TaskAttemptId taskId, final FragmentProto[] fragments, final Path workDir) { this.queryContext = queryContext; if (executionBlockContext != null) { // For unit tests this.workerContext = executionBlockContext.getWorkerContext(); this.sharedResource = executionBlockContext.getSharedResource(); } this.taskId = taskId; if (fragments != null) { for (FragmentProto t : fragments) { if (fragmentMap.containsKey(t.getId())) { fragmentMap.get(t.getId()).add(t); } else { List<FragmentProto> frags = new ArrayList<FragmentProto>(); frags.add(t); fragmentMap.put(t.getId(), frags); } } } this.workDir = workDir; this.shuffleFileOutputs = Maps.newHashMap(); this.state = TaskAttemptState.TA_PENDING; this.partitionOutputVolume = Maps.newHashMap(); this.partitions = TUtil.newList(); // set to system timezone for forwarded query this.evalContext.setTimeZone(queryContext.getConf().getSystemTimezone()); }
public static void startScriptExecutors(QueryContext queryContext, EvalContext evalContext, List<Target> targets) throws IOException { for (Target target : targets) { EvalNode eval = target.getEvalTree(); if (eval instanceof GeneralFunctionEval) { GeneralFunctionEval functionEval = (GeneralFunctionEval) eval; if (functionEval.getFuncDesc().getInvocation().hasPython()) { TajoScriptEngine scriptExecutor = new PythonScriptEngine(functionEval.getFuncDesc()); evalContext.addScriptEngine(eval, scriptExecutor); scriptExecutor.start(queryContext.getConf()); } } } }
@Override public EvalNode bind(EvalContext evalContext, Schema schema) { super.bind(evalContext, schema); try { if (evalContext != null && evalContext.hasScriptEngine(this)) { this.invokeContext.setScriptEngine(evalContext.getScriptEngine(this)); this.invokeContext.getScriptEngine().setFirstPhase(firstPhase); this.invokeContext.getScriptEngine().setLastPhase(lastPhase); } this.functionInvoke.init(invokeContext); } catch (IOException e) { throw new RuntimeException(e); } return this; }
@Override public EvalNode bind(@Nullable EvalContext evalContext, Schema schema) { if (evalContext != null) { timezone = evalContext.getTimeZone(); } return super.bind(evalContext, schema); }
LogicalRootNode rootNode = plan.getRootBlock().getRoot(); EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId));
@Override public EvalNode bind(EvalContext evalContext, Schema schema) { super.bind(evalContext, schema); try { this.funcInvoke = FunctionInvoke.newInstance(funcDesc); if (evalContext != null) { if (evalContext.hasScriptEngine(this)) { this.invokeContext.setScriptEngine(evalContext.getScriptEngine(this)); } if (evalContext.hasTimeZone()) { this.invokeContext.setTimeZone(evalContext.getTimeZone()); } } this.funcInvoke.init(invokeContext); } catch (IOException e) { throw new RuntimeException(e); } return this; }
current = new GeneralFunctionEval(context, funcDesc, params); if (evalContext != null && funcDesc.getInvocation().hasPython()) { evalContext.addScriptEngine(current, new PythonScriptEngine(funcDesc)); evalContext.addScriptEngine(current, new PythonScriptEngine(funcDesc, aggFunc.isFirstPhase(), aggFunc.isLastPhase()));
public static void stopScriptExecutors(EvalContext evalContext) { for (TajoScriptEngine executor : evalContext.getAllScriptEngines()) { executor.shutdown(); } }
LogicalRootNode rootNode = plan.getRootBlock().getRoot(); EvalContext evalContext = new EvalContext(); evalContext.setTimeZone(TimeZone.getTimeZone(timezoneId));
current = new GeneralFunctionEval(context, funcDesc, params); if (evalContext != null && funcDesc.getInvocation().hasPython()) { evalContext.addScriptEngine(current, new PythonScriptEngine(funcDesc)); evalContext.addScriptEngine(current, new PythonScriptEngine(funcDesc, aggFunc.isFirstPhase(), aggFunc.isLastPhase()));