static RegionLocateType getLocateType(Scan scan) { if (scan.isReversed()) { if (isEmptyStartRow(scan.getStartRow())) { return RegionLocateType.BEFORE; } else { return scan.includeStartRow() ? RegionLocateType.CURRENT : RegionLocateType.BEFORE; } } else { return scan.includeStartRow() ? RegionLocateType.CURRENT : RegionLocateType.AFTER; } }
private static Cell createStartKey(Scan scan, ScanInfo scanInfo) { if (scan.includeStartRow()) { return createStartKeyFromRow(scan.getStartRow(), scanInfo); } else { return PrivateCellUtil.createLastOnRow(scan.getStartRow()); } }
@Before public void setUp() throws Exception { byte[] ROW_BEFORE = ConnectionUtils.createCloseRowBefore(ROW); Configuration conf = Mockito.mock(Configuration.class); HRegionLocation regionLocation = Mockito.mock(HRegionLocation.class); ServerName serverName = Mockito.mock(ServerName.class); Mockito.when(connection.getConfiguration()).thenReturn(conf); Mockito.when(regionLocations.size()).thenReturn(1); Mockito.when(regionLocations.getRegionLocation(0)).thenReturn(regionLocation); Mockito.when(regionLocation.getHostname()).thenReturn("localhost"); Mockito.when(regionLocation.getServerName()).thenReturn(serverName); Mockito.when(scan.includeStartRow()).thenReturn(true); Mockito.when(scan.getStartRow()).thenReturn(ROW); }
matcher, scan.getStartRow(), scan.includeStartRow(), scan.getStopRow(), scan.includeStopRow(), readPt, false); if (fileScanners == null) {
"', " + (scan.includeStartRow() ? "inclusive" : "exclusive"));
.<AggregateService, AggregateResponse> coprocessorService(AggregateService::newStub, (stub, controller, rpcCallback) -> stub.getMedian(controller, req, rpcCallback), callback) .fromRow(nullToEmpty(scan.getStartRow()), scan.includeStartRow()) .toRow(nullToEmpty(scan.getStopRow()), scan.includeStopRow()).execute(); return future;
@Override protected ScannerCallable createScannerCallable() { if (!scan.includeStartRow() && !isEmptyStartRow(scan.getStartRow())) { // we have not implemented locate to next row for sync client yet, so here we change the // inclusive of start row to true. scan.withStartRow(createClosestRowAfter(scan.getStartRow()), true); } return new ScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, this.rpcControllerFactory); } }
public static <R, S, P extends Message, Q extends Message, T extends Message> CompletableFuture<Long> rowCount(AsyncTable<?> table, ColumnInterpreter<R, S, P, Q, T> ci, Scan scan) { CompletableFuture<Long> future = new CompletableFuture<>(); AggregateRequest req; try { req = validateArgAndGetPB(scan, ci, true); } catch (IOException e) { future.completeExceptionally(e); return future; } AbstractAggregationCallback<Long> callback = new AbstractAggregationCallback<Long>(future) { private long count; @Override protected void aggregate(RegionInfo region, AggregateResponse resp) throws IOException { count += resp.getFirstPart(0).asReadOnlyByteBuffer().getLong(); } @Override protected Long getFinalResult() { return count; } }; table .<AggregateService, AggregateResponse> coprocessorService(AggregateService::newStub, (stub, controller, rpcCallback) -> stub.getRowNum(controller, req, rpcCallback), callback) .fromRow(nullToEmpty(scan.getStartRow()), scan.includeStartRow()) .toRow(nullToEmpty(scan.getStopRow()), scan.includeStopRow()).execute(); return future; }
.<AggregateService, AggregateResponse> coprocessorService(AggregateService::newStub, (stub, controller, rpcCallback) -> stub.getSum(controller, req, rpcCallback), callback) .fromRow(nullToEmpty(scan.getStartRow()), scan.includeStartRow()) .toRow(nullToEmpty(scan.getStopRow()), scan.includeStopRow()).execute(); return future;
.<AggregateService, AggregateResponse> coprocessorService(AggregateService::newStub, (stub, controller, rpcCallback) -> stub.getMin(controller, req, rpcCallback), callback) .fromRow(nullToEmpty(scan.getStartRow()), scan.includeStartRow()) .toRow(nullToEmpty(scan.getStopRow()), scan.includeStopRow()).execute(); return future;
.<AggregateService, AggregateResponse> coprocessorService(AggregateService::newStub, (stub, controller, rpcCallback) -> stub.getStd(controller, req, rpcCallback), callback) .fromRow(nullToEmpty(scan.getStartRow()), scan.includeStartRow()) .toRow(nullToEmpty(scan.getStopRow()), scan.includeStopRow()).execute(); return future;
.<AggregateService, AggregateResponse> coprocessorService(AggregateService::newStub, (stub, controller, rpcCallback) -> stub.getMax(controller, req, rpcCallback), callback) .fromRow(nullToEmpty(scan.getStartRow()), scan.includeStartRow()) .toRow(nullToEmpty(scan.getStopRow()), scan.includeStopRow()).execute(); return future;
.<AggregateService, AggregateResponse> coprocessorService(AggregateService::newStub, (stub, controller, rpcCallback) -> stub.getAvg(controller, req, rpcCallback), callback) .fromRow(nullToEmpty(scan.getStartRow()), scan.includeStartRow()) .toRow(nullToEmpty(scan.getStopRow()), scan.includeStopRow()).execute(); return future;
includeStartRow = scan.includeStartRow(); stopRow = scan.getStopRow(); includeStopRow = scan.includeStopRow();
public AsyncClientScanner(Scan scan, AdvancedScanResultConsumer consumer, TableName tableName, AsyncConnectionImpl conn, Timer retryTimer, long pauseNs, int maxAttempts, long scanTimeoutNs, long rpcTimeoutNs, int startLogErrorsCnt) { if (scan.getStartRow() == null) { scan.withStartRow(EMPTY_START_ROW, scan.includeStartRow()); } if (scan.getStopRow() == null) { scan.withStopRow(EMPTY_END_ROW, scan.includeStopRow()); } this.scan = scan; this.consumer = consumer; this.tableName = tableName; this.conn = conn; this.retryTimer = retryTimer; this.pauseNs = pauseNs; this.maxAttempts = maxAttempts; this.scanTimeoutNs = scanTimeoutNs; this.rpcTimeoutNs = rpcTimeoutNs; this.startLogErrorsCnt = startLogErrorsCnt; this.resultCache = createScanResultCache(scan); if (scan.isScanMetricsEnabled()) { this.scanMetrics = new ScanMetrics(); consumer.onScanMetricsCreated(scanMetrics); } else { this.scanMetrics = null; } }
if (scan.includeStartRow() && !isEmptyStartRow(getRow())) {
scan.includeStartRow(), scan.getStopRow(), scan.includeStopRow(), this.readPt));
scanBuilder.setMvccReadPoint(mvccReadPoint); if (!scan.includeStartRow()) { scanBuilder.setIncludeStartRow(false);
scanBuilder.setMvccReadPoint(mvccReadPoint); if (!scan.includeStartRow()) { scanBuilder.setIncludeStartRow(false);
@Override protected ScannerCallable createScannerCallable() { if (!scan.includeStartRow() && !isEmptyStartRow(scan.getStartRow())) { // we have not implemented locate to next row for sync client yet, so here we change the // inclusive of start row to true. scan.withStartRow(createClosestRowAfter(scan.getStartRow()), true); } return new ScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, this.rpcControllerFactory); } }