예제 #1
0
 public static Scan newScan(Scan scan) {
   try {
     Scan newScan = new Scan(scan);
     // Clone the underlying family map instead of sharing it between
     // the existing and cloned Scan (which is the retarded default
     // behavior).
     TreeMap<byte[], NavigableSet<byte[]>> existingMap =
         (TreeMap<byte[], NavigableSet<byte[]>>) scan.getFamilyMap();
     Map<byte[], NavigableSet<byte[]>> clonedMap =
         new TreeMap<byte[], NavigableSet<byte[]>>(existingMap);
     newScan.setFamilyMap(clonedMap);
     // Carry over the reversed attribute
     newScan.setReversed(scan.isReversed());
     newScan.setSmall(scan.isSmall());
     return newScan;
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
예제 #2
0
  public static RawScanQueryMatcher create(
      Scan scan,
      ScanInfo scanInfo,
      ColumnTracker columns,
      boolean hasNullColumn,
      long oldestUnexpiredTS,
      long now) {
    if (scan.isReversed()) {
      return new RawScanQueryMatcher(
          scan, scanInfo, columns, hasNullColumn, oldestUnexpiredTS, now) {

        @Override
        protected boolean moreRowsMayExistsAfter(int cmpToStopRow) {
          return cmpToStopRow > 0;
        }
      };
    } else {
      return new RawScanQueryMatcher(
          scan, scanInfo, columns, hasNullColumn, oldestUnexpiredTS, now);
    }
  }