use of com.apple.foundationdb.record.metadata.expressions.VersionKeyExpression in project fdb-record-layer by FoundationDB.
the class RecordQueryPlanner method planVersion.
@Nullable
private ScoredPlan planVersion(@Nonnull CandidateScan candidateScan, @Nonnull KeyExpression indexExpr, @Nonnull QueryRecordFunctionWithComparison filter, @Nullable KeyExpression sort) {
if (indexExpr instanceof VersionKeyExpression) {
final Comparisons.Comparison comparison = filter.getComparison();
final ScanComparisons comparisons = ScanComparisons.from(comparison);
if (sort == null || sort.equals(VersionKeyExpression.VERSION)) {
IndexScanParameters scanParameters = IndexScanComparisons.byValue(comparisons);
RecordQueryPlan plan = new RecordQueryIndexPlan(candidateScan.index.getName(), scanParameters, candidateScan.reverse);
return new ScoredPlan(1, plan, Collections.emptyList(), false);
}
} else if (indexExpr instanceof ThenKeyExpression) {
ThenKeyExpression then = (ThenKeyExpression) indexExpr;
if (sort == null) {
// && !then.createsDuplicates()) {
return planVersion(candidateScan, then.getChildren().get(0), filter, null);
} else {
return new AndWithThenPlanner(candidateScan, then, Collections.singletonList(filter), sort).plan();
}
}
return null;
}
Aggregations