public OProjection getExpandContent() { OProjection result = new OProjection(-1); result.setItems(new ArrayList<>()); result.getItems().add(this.getItems().get(0).getExpandContent()); return result; }
info.projectionAfterOrderBy.setItems(new ArrayList<>()); for (String alias : info.projection.getAllAliases()) { info.projectionAfterOrderBy.getItems().add(projectionFromAlias(new OIdentifier(alias)));
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)); } }
/** * for backward compatibility, translate "distinct(foo)" to "DISTINCT foo". This method modifies the projection itself. * * @param projection the projection */ protected static OProjection translateDistinct(OProjection projection) { if (projection != null && projection.getItems().size() == 1) { if (isDistinct(projection.getItems().get(0))) { projection = projection.copy(); OProjectionItem item = projection.getItems().get(0); OFunctionCall function = ((OBaseExpression) item.getExpression().getMathExpression()).getIdentifier().getLevelZero() .getFunctionCall(); OExpression exp = function.getParams().get(0); OProjectionItem resultItem = new OProjectionItem(-1); resultItem.setAlias(item.getAlias()); resultItem.setExpression(exp.copy()); OProjection result = new OProjection(-1); result.setItems(new ArrayList<>()); result.setDistinct(true); result.getItems().add(resultItem); return result; } } return projection; }
info.preAggregateProjection.setItems(new ArrayList<>());