Example #1
0
 private Operator exceptPlan(
     IndexRowType t1, IndexRowType t2, boolean ascending, boolean removeDuplicates) {
   Operator plan =
       except_Ordered(
           indexScan_Default(t1, IndexKeyRange.unbounded(t1), ordering(field(t1, 0), ascending)),
           indexScan_Default(t2, IndexKeyRange.unbounded(t2), ordering(field(t2, 0), ascending)),
           t1,
           t2,
           2,
           2,
           ascending(ascending),
           removeDuplicates);
   return plan;
 }
Example #2
0
 private void intersect(int runs, int leftIndexKey, int rightIndexKey, String label) {
   Ordering ordering = new Ordering();
   ordering.append(field(indexRowType, 1), true);
   ordering.append(field(indexRowType, 2), true);
   ordering.append(field(indexRowType, 3), true);
   ordering.append(field(indexRowType, 4), true);
   ordering.append(field(indexRowType, 5), true);
   IndexBound leftBound =
       new IndexBound(row(indexRowType, leftIndexKey), new SetColumnSelector(0));
   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 intersect =
       intersect_Ordered(
           timeLeftSetup,
           timeRightSetup,
           indexRowType,
           indexRowType,
           5,
           5,
           5,
           JoinType.INNER_JOIN,
           IntersectOption.OUTPUT_LEFT,
           null);
   long start = System.nanoTime();
   for (int r = 0; r < runs; r++) {
     Cursor cursor = cursor(intersect, 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));
   }
 }
 @Test
 public void test() {
   IndexBound bound = new IndexBound(row(idxRowType, 110L, 15L), new SetColumnSelector(0, 1));
   IndexKeyRange range = IndexKeyRange.bounded(idxRowType, bound, true, bound, true);
   API.Ordering ordering = new API.Ordering();
   ordering.append(ExpressionGenerators.field(idxRowType, 0), true);
   ordering.append(ExpressionGenerators.field(idxRowType, 1), true);
   Operator plan = indexScan_Default(idxRowType, range, ordering);
   compareRows(new Row[0], cursor(plan, queryContext, queryBindings));
 }
 private IndexKeyRange unbounded() {
   return IndexKeyRange.unbounded(idxRowType);
 }
 private IndexKeyRange zEq(long z) {
   IndexBound bound = new IndexBound(row(tZIndexRowType, z), new SetColumnSelector(0));
   return IndexKeyRange.bounded(tZIndexRowType, bound, true, bound, true);
 }