Java 类org.apache.hadoop.hbase.regionserver.ScannerContext 实例源码

项目:Gaffer    文件:QueryScanner.java   
@Override
public boolean nextRaw(final List<Cell> output, final ScannerContext scannerContext) throws IOException {
    final List<Cell> input = new ArrayList<>();
    final boolean shouldContinue = getScanner().nextRaw(input);
    _next(input, output);
    return shouldContinue;
}
项目:hbase    文件:TestRegionObserverInterface.java   
@Override
public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
    InternalScanner scanner, ScanType scanType, CompactionLifeCycleTracker tracker,
    CompactionRequest request) {
  return new InternalScanner() {

    @Override
    public boolean next(List<Cell> results, ScannerContext scannerContext) throws IOException {
      List<Cell> internalResults = new ArrayList<>();
      boolean hasMore;
      do {
        hasMore = scanner.next(internalResults, scannerContext);
        if (!internalResults.isEmpty()) {
          long row = Bytes.toLong(CellUtil.cloneValue(internalResults.get(0)));
          if (row % 2 == 0) {
            // return this row
            break;
          }
          // clear and continue
          internalResults.clear();
        }
      } while (hasMore);

      if (!internalResults.isEmpty()) {
        results.addAll(internalResults);
      }
      return hasMore;
    }

    @Override
    public void close() throws IOException {
      scanner.close();
    }
  };
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext)
    throws IOException {
  if (kvs.isEmpty()) return false;
  result.add(kvs.remove(0));
  return !kvs.isEmpty();
}
项目:spliceengine    文件:MemStoreFlushAwareScanner.java   
public boolean internalNext(List<Cell> outResult,ScannerContext scannerContext) throws IOException {
    if (beginRow) {
        beginRow = false;
        if (LOG.isTraceEnabled())
            SpliceLogUtils.trace(LOG, "Next: memstore begin");
        return outResult.add(ClientRegionConstants.MEMSTORE_BEGIN);
    }
    if (endRowNeedsToBeReturned) {
        try {
            outResult.add(new KeyValue(Bytes.toBytes(counter), ClientRegionConstants.HOLD, ClientRegionConstants.HOLD, HConstants.LATEST_TIMESTAMP, ClientRegionConstants.HOLD));
            return HBasePlatformUtils.scannerEndReached(scannerContext);
        } finally {
            counter++;
        }
    }
    if (didWeFlush()) {
        if (flushAlreadyReturned) {
            try {
                outResult.add(new KeyValue(Bytes.toBytes(counter),
                        ClientRegionConstants.FLUSH, ClientRegionConstants.FLUSH, Long.MAX_VALUE, ClientRegionConstants.FLUSH));
                return HBasePlatformUtils.scannerEndReached(scannerContext);
            } finally {
                counter++;
            }
        } else {
            flushAlreadyReturned = true;
            if (LOG.isTraceEnabled())
                SpliceLogUtils.trace(LOG, "Next: returning begin flush ");
            outResult.add(ClientRegionConstants.MEMSTORE_BEGIN_FLUSH);
        }
        return HBasePlatformUtils.scannerEndReached(scannerContext);
    }
    return directInternalNext(outResult,scannerContext);
}
项目:spliceengine    文件:MemStoreFlushAwareScanner.java   
public boolean internalNext(List<Cell> outResult,ScannerContext scannerContext) throws IOException {
    if (beginRow) {
        beginRow = false;
        if (LOG.isTraceEnabled())
            SpliceLogUtils.trace(LOG, "Next: memstore begin");
        return outResult.add(ClientRegionConstants.MEMSTORE_BEGIN);
    }
    if (endRowNeedsToBeReturned) {
        try {
            outResult.add(new KeyValue(Bytes.toBytes(counter), ClientRegionConstants.HOLD, ClientRegionConstants.HOLD, HConstants.LATEST_TIMESTAMP, ClientRegionConstants.HOLD));
            return HBasePlatformUtils.scannerEndReached(scannerContext);
        } finally {
            counter++;
        }
    }
    if (didWeFlush()) {
        if (flushAlreadyReturned) {
            try {
                outResult.add(new KeyValue(Bytes.toBytes(counter),
                        ClientRegionConstants.FLUSH, ClientRegionConstants.FLUSH, Long.MAX_VALUE, ClientRegionConstants.FLUSH));
                return HBasePlatformUtils.scannerEndReached(scannerContext);
            } finally {
                counter++;
            }
        } else {
            flushAlreadyReturned = true;
            if (LOG.isTraceEnabled())
                SpliceLogUtils.trace(LOG, "Next: returning begin flush ");
            outResult.add(ClientRegionConstants.MEMSTORE_BEGIN_FLUSH);
        }
        return HBasePlatformUtils.scannerEndReached(scannerContext);
    }
    return directInternalNext(outResult,scannerContext);
}
项目:ditb    文件:TestCoprocessorInterface.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext)
    throws IOException {
  return delegate.next(result, scannerContext);
}
项目:ditb    文件:TestCoprocessorInterface.java   
@Override
public boolean nextRaw(List<Cell> result, ScannerContext context)
    throws IOException {
  return delegate.nextRaw(result, context);
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext)
    throws IOException {
  return next(result);
}
项目:incubator-omid    文件:OmidRegionScanner.java   
public boolean next(List<Cell> result,
        ScannerContext scannerContext) throws IOException {
    return next(result, scannerContext.getBatchLimit());
}
项目:incubator-omid    文件:OmidRegionScanner.java   
public boolean nextRaw(List<Cell> result,
        ScannerContext scannerContext) throws IOException {
    return nextRaw(result, scannerContext.getBatchLimit());
}
项目:Gaffer    文件:GafferScanner.java   
@Override
public boolean next(final List<Cell> output, final ScannerContext scannerContext) throws IOException {
    return next(output);
}
项目:hbase    文件:TestBlockEvictionFromClient.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
  return delegate.next(result, scannerContext);
}
项目:hbase    文件:TestCoprocessorInterface.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext)
    throws IOException {
  return delegate.next(result, scannerContext);
}
项目:hbase    文件:TestCoprocessorInterface.java   
@Override
public boolean nextRaw(List<Cell> result, ScannerContext context)
    throws IOException {
  return delegate.nextRaw(result, context);
}
项目:hbase    文件:TestRegionObserverScannerOpenHook.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
  return false;
}
项目:hbase    文件:TestCompactor.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
  if (kvs.isEmpty()) return false;
  result.add(kvs.remove(0));
  return !kvs.isEmpty();
}
项目:hbase    文件:DelegatingInternalScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
  return scanner.next(result, scannerContext);
}
项目:hbase    文件:WriteHeavyIncrementObserver.java   
private InternalScanner wrap(byte[] family, InternalScanner scanner) {
  return new InternalScanner() {

    private List<Cell> srcResult = new ArrayList<>();

    private byte[] row;

    private byte[] qualifier;

    private long timestamp;

    private long sum;

    @Override
    public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
      boolean moreRows = scanner.next(srcResult, scannerContext);
      if (srcResult.isEmpty()) {
        if (!moreRows && row != null) {
          result.add(createCell(row, family, qualifier, timestamp, sum));
        }
        return moreRows;
      }
      Cell firstCell = srcResult.get(0);
      // Check if there is a row change first. All the cells will come from the same row so just
      // check the first one once is enough.
      if (row == null) {
        row = CellUtil.cloneRow(firstCell);
        qualifier = CellUtil.cloneQualifier(firstCell);
      } else if (!CellUtil.matchingRows(firstCell, row)) {
        result.add(createCell(row, family, qualifier, timestamp, sum));
        row = CellUtil.cloneRow(firstCell);
        qualifier = CellUtil.cloneQualifier(firstCell);
        sum = 0;
      }
      srcResult.forEach(c -> {
        if (CellUtil.matchingQualifier(c, qualifier)) {
          sum += Bytes.toLong(c.getValueArray(), c.getValueOffset());
        } else {
          result.add(createCell(row, family, qualifier, timestamp, sum));
          qualifier = CellUtil.cloneQualifier(c);
          sum = Bytes.toLong(c.getValueArray(), c.getValueOffset());
        }
        timestamp = c.getTimestamp();
      });
      if (!moreRows) {
        result.add(createCell(row, family, qualifier, timestamp, sum));
      }
      srcResult.clear();
      return moreRows;
    }

    @Override
    public void close() throws IOException {
      scanner.close();
    }
  };
}
项目:spliceengine    文件:SICompactionScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:HBase10ClientSideRegionScanner.java   
public boolean nextRaw(List<Cell> cells, ScannerContext scannerContext) throws IOException {
    return nextRaw(cells);
}
项目:spliceengine    文件:HBase10ClientSideRegionScanner.java   
public boolean next(List<Cell> cells, ScannerContext scannerContext) throws IOException {
    return nextRaw(cells);
}
项目:spliceengine    文件:MemstoreKeyValueScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:SplitRegionScanner.java   
@Override
public boolean nextRaw(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return nextInternal(result);
}
项目:spliceengine    文件:SplitRegionScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return nextInternal(result);
}
项目:spliceengine    文件:IteratorRegionScanner.java   
@Override
public boolean nextRaw(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:IteratorRegionScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:SICompactionScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:HBase10ClientSideRegionScanner.java   
public boolean nextRaw(List<Cell> cells, ScannerContext scannerContext) throws IOException {
    return false;
}
项目:spliceengine    文件:HBase10ClientSideRegionScanner.java   
public boolean next(List<Cell> cells, ScannerContext scannerContext) throws IOException {
    return false;
}
项目:spliceengine    文件:MemstoreKeyValueScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:MemStoreFlushAwareScanner.java   
boolean directInternalNext(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return super.next(result,scannerContext);
}
项目:spliceengine    文件:MemStoreFlushAwareScanner.java   
@Override
public boolean next(List<Cell> outResult, ScannerContext scannerContext) throws IOException {
    return internalNext(outResult,scannerContext);
}
项目:spliceengine    文件:SplitRegionScanner.java   
@Override
public boolean nextRaw(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return nextInternal(result);
}
项目:spliceengine    文件:SplitRegionScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return nextInternal(result);
}
项目:spliceengine    文件:IteratorRegionScanner.java   
@Override
public boolean nextRaw(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:IteratorRegionScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:SICompactionScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}
项目:spliceengine    文件:HBase10ClientSideRegionScanner.java   
public boolean nextRaw(List<Cell> cells, ScannerContext scannerContext) throws IOException {
    return false;
}
项目:spliceengine    文件:HBase10ClientSideRegionScanner.java   
public boolean next(List<Cell> cells, ScannerContext scannerContext) throws IOException {
    return false;
}
项目:spliceengine    文件:MemstoreKeyValueScanner.java   
@Override
public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException {
    return next(result);
}