use of com.apple.foundationdb.record.query.plan.plans.RecordQueryScanPlan in project fdb-record-layer by FoundationDB.
the class UnmatchedFieldsCountProperty method evaluateAtExpression.
@Nonnull
@Override
public Integer evaluateAtExpression(@Nonnull RelationalExpression expression, @Nonnull List<Integer> childResults) {
int total = 0;
for (Integer result : childResults) {
if (result != null) {
total += result;
}
}
if (expression instanceof RecordQueryCoveringIndexPlan) {
expression = ((RecordQueryCoveringIndexPlan) expression).getIndexPlan();
}
final int columnSize;
if (expression instanceof RecordQueryPlanWithComparisons) {
final ScanComparisons comparisons = ((RecordQueryPlanWithComparisons) expression).getComparisons();
if (expression instanceof RecordQueryPlanWithIndex) {
final String indexName = ((RecordQueryPlanWithIndex) expression).getIndexName();
columnSize = planContext.getIndexByName(indexName).getRootExpression().getColumnSize();
} else if (expression instanceof RecordQueryScanPlan) {
columnSize = planContext.getGreatestPrimaryKeyWidth();
} else {
throw new RecordCoreException("unhandled plan with comparisons: can't find key expression");
}
return total + columnSize - (comparisons.getEqualitySize() + (comparisons.isEquality() ? 0 : 1));
} else {
return total;
}
}
use of com.apple.foundationdb.record.query.plan.plans.RecordQueryScanPlan in project fdb-record-layer by FoundationDB.
the class ImplementPhysicalScanRule method onMatch.
@Override
public void onMatch(@Nonnull PlannerRuleCall call) {
final PrimaryScanExpression logical = call.get(root);
call.yield(call.ref(new RecordQueryScanPlan(logical.getRecordTypes(), logical.scanComparisons(), logical.isReverse())));
}
Aggregations