use of com.apple.foundationdb.record.query.plan.plans.RecordQueryPlanWithNoChildren in project fdb-record-layer by FoundationDB.
the class FDBRecordStoreScanLimitTest method getMaximumToScan.
private int getMaximumToScan(QueryPlan<?> plan) throws Exception {
if (plan instanceof RecordQueryPlanWithNoChildren) {
try (FDBRecordContext context = openContext()) {
openSimpleRecordStore(context);
RecordQueryPlanWithNoChildren planWithNoChildren = (RecordQueryPlanWithNoChildren) plan;
try (RecordCursorIterator<FDBQueriedRecord<Message>> cursor = recordStore.executeQuery(planWithNoChildren, null, ExecuteProperties.SERIAL_EXECUTE).asIterator()) {
int maximumToScan = 0;
while (cursor.hasNext()) {
FDBQueriedRecord<Message> record = cursor.next();
maximumToScan += record.getStoredRecord().getKeyCount() + (record.getStoredRecord().isVersionedInline() ? 1 : 0);
}
return maximumToScan;
}
}
}
int maximumToScan = 0;
for (QueryPlan<?> child : plan.getQueryPlanChildren()) {
maximumToScan += getMaximumToScan(child);
}
return maximumToScan;
}
Aggregations