@Override public String prettyPrint(int depth, int indent) { String spaces = OExecutionStepInternal.getIndent(depth, indent); return spaces + "+ LET (once)\n" + spaces + " " + varName + " = \n" + box(spaces + " ", this.subExecutionPlan.prettyPrint(0, indent)); }
public int usedIndexes(OGraph graph) { OExecutionPlan executionPlan = this.explain(graph).get(); if (target > 1) { return executionPlan.getSteps().stream().filter(step -> (step instanceof GlobalLetQueryStep)).map(s -> { GlobalLetQueryStep subStep = (GlobalLetQueryStep) s; return (int) subStep.getSubExecutionPlans().stream() .filter(plan -> plan.getSteps().stream().filter((step) -> step instanceof FetchFromIndexStep).count() > 0).count(); }).reduce(0, (a, b) -> a + b); } else { return (int) executionPlan.getSteps().stream().filter((step) -> step instanceof FetchFromIndexStep).count(); } }
private void calculate(OCommandContext ctx) { if (executed) { return; } ctx.setVariable(varName.getStringValue(), toList(new OLocalResultSet(subExecutionPlan))); executed = true; }
private void handleGlobalLet(OSelectExecutionPlan result, QueryPlanningInfo info, OCommandContext ctx, boolean profilingEnabled) { if (info.globalLetClause != null) { List<OLetItem> items = info.globalLetClause.getItems(); for (OLetItem item : items) { if (item.getExpression() != null) { result.chain(new GlobalLetExpressionStep(item.getVarName(), item.getExpression(), ctx, profilingEnabled)); } else { result.chain(new GlobalLetQueryStep(item.getVarName(), item.getQuery(), ctx, profilingEnabled)); } info.globalLetPresent = true; } } }