private boolean handleHardwiredCountOnIndex(OSelectExecutionPlan result, QueryPlanningInfo info, OCommandContext ctx, boolean profilingEnabled) { OIndexIdentifier targetIndex = info.target == null ? null : info.target.getItem().getIndex(); if (targetIndex == null) { return false; } if (info.distinct || info.expand) { return false; } if (info.preAggregateProjection != null) { return false; } if (!isCountStar(info)) { return false; } if (!isMinimalQuery(info)) { return false; } result.chain(new CountFromIndexStep(targetIndex, info.projection.getAllAliases().iterator().next(), ctx, profilingEnabled)); return true; }
private boolean handleHardwiredCountOnClass(OSelectExecutionPlan result, QueryPlanningInfo info, OCommandContext ctx, boolean profilingEnabled) { OIdentifier targetClass = info.target == null ? null : info.target.getItem().getIdentifier(); if (targetClass == null) { return false; } if (info.distinct || info.expand) { return false; } if (info.preAggregateProjection != null) { return false; } if (!isCountStar(info)) { return false; } if (!isMinimalQuery(info)) { return false; } result.chain(new CountFromClassStep(targetClass, info.projection.getAllAliases().iterator().next(), ctx, profilingEnabled)); return true; }
List<OProjectionItem> additionalOrderByProjections = calculateAdditionalOrderByProjections(info.projection.getAllAliases(), newOrderBy); if (additionalOrderByProjections.size() > 0) { info.projectionAfterOrderBy = new OProjection(-1); info.projectionAfterOrderBy.setItems(new ArrayList<>()); for (String alias : info.projection.getAllAliases()) { info.projectionAfterOrderBy.getItems().add(projectionFromAlias(new OIdentifier(alias)));
for (String alias : info.preAggregateProjection.getAllAliases()) {