@Override public OExecutionStep copy(OCommandContext ctx) { return new ProjectionCalculationStep(projection.copy(), ctx, profilingEnabled); } }
private void handleReturn(OInsertExecutionPlan result, OProjection returnStatement, OCommandContext ctx, boolean profilingEnabled) { if (returnStatement != null) { result.chain(new ProjectionCalculationStep(returnStatement, ctx, profilingEnabled)); } }
private void handleResultForReturnAfter(OUpdateExecutionPlan result, OCommandContext ctx, boolean returnAfter, OProjection returnProjection, boolean profilingEnabled) { if (returnAfter) { //re-convert to normal step result.chain(new ConvertToResultInternalStep(ctx, profilingEnabled)); if (returnProjection != null) { result.chain(new ProjectionCalculationStep(returnProjection, ctx, profilingEnabled)); } } }
private void handleResultForReturnBefore(OUpdateExecutionPlan result, OCommandContext ctx, boolean returnBefore, OProjection returnProjection, boolean profilingEnabled) { if (returnBefore) { result.chain(new UnwrapPreviousValueStep(ctx, profilingEnabled)); if (returnProjection != null) { result.chain(new ProjectionCalculationStep(returnProjection, ctx, profilingEnabled)); } } }
private void handleResultForReturnBefore(OUpdateExecutionPlan result, OCommandContext ctx, boolean returnBefore, OProjection returnProjection, boolean profilingEnabled) { if (returnBefore) { result.chain(new UnwrapPreviousValueStep(ctx, profilingEnabled)); if (returnProjection != null) { result.chain(new ProjectionCalculationStep(returnProjection, ctx, profilingEnabled)); } } }
private void handleResultForReturnAfter(OUpdateExecutionPlan result, OCommandContext ctx, boolean returnAfter, OProjection returnProjection, boolean profilingEnabled) { if (returnAfter) { //re-convert to normal step result.chain(new ConvertToResultInternalStep(ctx, profilingEnabled)); if (returnProjection != null) { result.chain(new ProjectionCalculationStep(returnProjection, ctx, profilingEnabled)); } } }
private static void handleProjections(OSelectExecutionPlan result, QueryPlanningInfo info, OCommandContext ctx, boolean profilingEnabled) { if (!info.projectionsCalculated && info.projection != null) { if (info.preAggregateProjection != null) { result.chain(new ProjectionCalculationStep(info.preAggregateProjection, ctx, profilingEnabled)); } if (info.aggregateProjection != null) { result.chain(new AggregateProjectionCalculationStep(info.aggregateProjection, info.groupBy, ctx, profilingEnabled)); if (isCountOnly(info) && info.groupBy == null) { result.chain(new GuaranteeEmptyCountStep(info.aggregateProjection.getItems().get(0), ctx, profilingEnabled)); } } result.chain(new ProjectionCalculationStep(info.projection, ctx, profilingEnabled)); info.projectionsCalculated = true; } }
private void addReturnStep(OSelectExecutionPlan result, OCommandContext context, boolean profilingEnabled) { if (returnElements) { result.chain(new ReturnMatchElementsStep(context, profilingEnabled)); } else if (returnPaths) { result.chain(new ReturnMatchPathsStep(context, profilingEnabled)); } else if (returnPatterns) { result.chain(new ReturnMatchPatternsStep(context, profilingEnabled)); } else if (returnPathElements) { result.chain(new ReturnMatchPathElementsStep(context, profilingEnabled)); } else { OProjection projection = new OProjection(-1); projection.setItems(new ArrayList<>()); for (int i = 0; i < returnAliases.size(); i++) { OProjectionItem item = new OProjectionItem(-1); item.setExpression(returnItems.get(i)); item.setAlias(returnAliases.get(i)); item.setNestedProjection(returnNestedProjections.get(i)); projection.getItems().add(item); } result.chain(new ProjectionCalculationStep(projection, context, profilingEnabled)); } }
public static void handleOrderBy(OSelectExecutionPlan plan, QueryPlanningInfo info, OCommandContext ctx, boolean profilingEnabled) { int skipSize = info.skip == null ? 0 : info.skip.getValue(ctx); if (skipSize < 0) { throw new OCommandExecutionException("Cannot execute a query with a negative SKIP"); } int limitSize = info.limit == null ? -1 : info.limit.getValue(ctx); Integer maxResults = null; if (limitSize >= 0) { maxResults = skipSize + limitSize; } if (info.expand || info.unwind != null) { maxResults = null; } if (!info.orderApplied && info.orderBy != null && info.orderBy.getItems() != null && info.orderBy.getItems().size() > 0) { plan.chain(new OrderByStep(info.orderBy, maxResults, ctx, profilingEnabled)); if (info.projectionAfterOrderBy != null) { plan.chain(new ProjectionCalculationStep(info.projectionAfterOrderBy, ctx, profilingEnabled)); } } }
result.chain(new AggregateProjectionCalculationStep(info.aggregateProjection, info.groupBy, ctx, profilingEnabled)); result.chain(new GuaranteeEmptyCountStep(info.aggregateProjection.getItems().get(0), ctx, profilingEnabled)); result.chain(new ProjectionCalculationStep(info.projection, ctx, profilingEnabled)); return true;