IndexKeyRange leftKeyRange = IndexKeyRange.bounded(indexRowType, leftBound, true, leftBound, true);
IndexBound rightBound = new IndexBound(row(indexRowType, rightIndexKey), new SetColumnSelector(0));
IndexKeyRange rightKeyRange = IndexKeyRange.bounded(indexRowType, rightBound, true, rightBound, true);
Operator leftSetup = indexScan_Default(indexRowType, leftKeyRange, ordering);
Operator rightSetup = indexScan_Default(indexRowType, rightKeyRange, ordering);
TimeOperator timeLeftSetup = new TimeOperator(leftSetup);
TimeOperator timeRightSetup = new TimeOperator(rightSetup);
Operator union =
hKeyUnion_Ordered(
timeLeftSetup,
timeRightSetup,
indexRowType,
indexRowType,
5,
5,
5,
tRowType);
long start = System.nanoTime();
for (int r = 0; r < runs; r++) {
Cursor cursor = cursor(union, queryContext, queryBindings);
cursor.openTopLevel();
while (cursor.next() != null);
}
long stop = System.nanoTime();
long intersectNsec = stop - start - timeLeftSetup.elapsedNsec() - timeRightSetup.elapsedNsec();
if (label != null) {
// Report the difference
double averageUsecPerRow = intersectNsec / (1000.0 * runs * 2 * ROWS);
System.out.println(String.format("%s: %s usec/row",
label, averageUsecPerRow));