use of com.apple.foundationdb.record.query.plan.visitor.UnorderedPrimaryKeyDistinctVisitor in project fdb-record-layer by FoundationDB.
the class RecordQueryPlanner method tryToConvertToCoveringPlan.
@Nonnull
@SuppressWarnings("PMD.CompareObjectsWithEquals")
private RecordQueryPlan tryToConvertToCoveringPlan(@Nonnull PlanContext planContext, @Nonnull RecordQueryPlan chosenPlan) {
if (planContext.query.getRequiredResults() == null) {
// This should already be true when calling, but as a safety precaution, check here anyway.
return chosenPlan;
}
final Set<KeyExpression> resultFields = new HashSet<>(planContext.query.getRequiredResults().size());
for (KeyExpression resultField : planContext.query.getRequiredResults()) {
resultFields.addAll(resultField.normalizeKeyForPositions());
}
chosenPlan = chosenPlan.accept(new UnorderedPrimaryKeyDistinctVisitor(metaData, indexTypes, planContext.commonPrimaryKey));
@Nullable RecordQueryPlan withoutFetch = RecordQueryPlannerSubstitutionVisitor.removeIndexFetch(metaData, indexTypes, planContext.commonPrimaryKey, chosenPlan, resultFields);
return withoutFetch == null ? chosenPlan : withoutFetch;
}
Aggregations