HBASE-23847 Removed deprecated setStartRow from Scan (#1220)

Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
Jan Hentschel 2020-03-13 01:43:17 +01:00 committed by GitHub
parent e5b0455c38
commit 1b163d98b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 56 additions and 81 deletions

View File

@ -1501,7 +1501,7 @@ public final class BackupSystemTable implements Closeable {
byte[] startRow = Bytes.toBytes(BACKUP_INFO_PREFIX); byte[] startRow = Bytes.toBytes(BACKUP_INFO_PREFIX);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length); byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1); stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.setStartRow(startRow); scan.withStartRow(startRow);
scan.setStopRow(stopRow); scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.SESSIONS_FAMILY); scan.addFamily(BackupSystemTable.SESSIONS_FAMILY);
scan.setMaxVersions(1); scan.setMaxVersions(1);
@ -1541,7 +1541,7 @@ public final class BackupSystemTable implements Closeable {
byte[] startRow = rowkey(TABLE_RS_LOG_MAP_PREFIX, backupRoot); byte[] startRow = rowkey(TABLE_RS_LOG_MAP_PREFIX, backupRoot);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length); byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1); stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.setStartRow(startRow); scan.withStartRow(startRow);
scan.setStopRow(stopRow); scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY); scan.addFamily(BackupSystemTable.META_FAMILY);
@ -1582,7 +1582,7 @@ public final class BackupSystemTable implements Closeable {
byte[] startRow = rowkey(RS_LOG_TS_PREFIX, backupRoot); byte[] startRow = rowkey(RS_LOG_TS_PREFIX, backupRoot);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length); byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1); stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.setStartRow(startRow); scan.withStartRow(startRow);
scan.setStopRow(stopRow); scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY); scan.addFamily(BackupSystemTable.META_FAMILY);
scan.setMaxVersions(1); scan.setMaxVersions(1);
@ -1891,7 +1891,7 @@ public final class BackupSystemTable implements Closeable {
: rowkey(BULK_LOAD_PREFIX, backupId + BLK_LD_DELIM); : rowkey(BULK_LOAD_PREFIX, backupId + BLK_LD_DELIM);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length); byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1); stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.setStartRow(startRow); scan.withStartRow(startRow);
scan.setStopRow(stopRow); scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY); scan.addFamily(BackupSystemTable.META_FAMILY);
scan.setMaxVersions(1); scan.setMaxVersions(1);
@ -1939,7 +1939,7 @@ public final class BackupSystemTable implements Closeable {
byte[] startRow = Bytes.toBytes(WALS_PREFIX); byte[] startRow = Bytes.toBytes(WALS_PREFIX);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length); byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1); stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.setStartRow(startRow); scan.withStartRow(startRow);
scan.setStopRow(stopRow); scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY); scan.addFamily(BackupSystemTable.META_FAMILY);
return scan; return scan;
@ -1966,7 +1966,7 @@ public final class BackupSystemTable implements Closeable {
byte[] startRow = Bytes.toBytes(SET_KEY_PREFIX); byte[] startRow = Bytes.toBytes(SET_KEY_PREFIX);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length); byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1); stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.setStartRow(startRow); scan.withStartRow(startRow);
scan.setStopRow(stopRow); scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY); scan.addFamily(BackupSystemTable.META_FAMILY);
return scan; return scan;

View File

@ -575,7 +575,7 @@ public class MetaTableAccessor {
byte[] stopKey = getTableStopRowForMeta(tableName, QueryType.REGION); byte[] stopKey = getTableStopRowForMeta(tableName, QueryType.REGION);
Scan scan = getMetaScan(connection, -1); Scan scan = getMetaScan(connection, -1);
scan.setStartRow(startKey); scan.withStartRow(startKey);
scan.setStopRow(stopKey); scan.setStopRow(stopKey);
return scan; return scan;
} }

View File

@ -192,7 +192,7 @@ public class Scan extends Query {
*/ */
@Deprecated @Deprecated
public Scan(byte[] startRow) { public Scan(byte[] startRow) {
setStartRow(startRow); withStartRow(startRow);
} }
/** /**
@ -205,7 +205,7 @@ public class Scan extends Query {
*/ */
@Deprecated @Deprecated
public Scan(byte[] startRow, byte[] stopRow) { public Scan(byte[] startRow, byte[] stopRow) {
setStartRow(startRow); withStartRow(startRow);
setStopRow(stopRow); setStopRow(stopRow);
} }
@ -394,31 +394,6 @@ public class Scan extends Query {
return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp); return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
} }
/**
* Set the start row of the scan.
* <p>
* If the specified row does not exist, the Scanner will start from the next closest row after the
* specified row.
* @param startRow row to start scanner at or after
* @return this
* @throws IllegalArgumentException if startRow does not meet criteria for a row key (when length
* exceeds {@link HConstants#MAX_ROW_LENGTH})
* @deprecated since 2.0.0 and will be removed in 3.0.0. Use {@link #withStartRow(byte[])}
* instead. This method may change the inclusive of the stop row to keep compatible with the old
* behavior.
* @see #withStartRow(byte[])
* @see <a href="https://issues.apache.org/jira/browse/HBASE-17320">HBASE-17320</a>
*/
@Deprecated
public Scan setStartRow(byte[] startRow) {
withStartRow(startRow);
if (ClientUtil.areScanStartRowAndStopRowEqual(this.startRow, this.stopRow)) {
// for keeping the old behavior that a scan with the same start and stop row is a get scan.
this.includeStopRow = true;
}
return this;
}
/** /**
* Set the start row of the scan. * Set the start row of the scan.
* <p> * <p>
@ -526,17 +501,17 @@ public class Scan extends Query {
* <p>This is a utility method that converts the desired rowPrefix into the appropriate values * <p>This is a utility method that converts the desired rowPrefix into the appropriate values
* for the startRow and stopRow to achieve the desired result.</p> * for the startRow and stopRow to achieve the desired result.</p>
* <p>This can safely be used in combination with setFilter.</p> * <p>This can safely be used in combination with setFilter.</p>
* <p><b>NOTE: Doing a {@link #setStartRow(byte[])} and/or {@link #setStopRow(byte[])} * <p><b>NOTE: Doing a {@link #withStartRow(byte[])} and/or {@link #setStopRow(byte[])}
* after this method will yield undefined results.</b></p> * after this method will yield undefined results.</b></p>
* @param rowPrefix the prefix all rows must start with. (Set <i>null</i> to remove the filter.) * @param rowPrefix the prefix all rows must start with. (Set <i>null</i> to remove the filter.)
* @return this * @return this
*/ */
public Scan setRowPrefixFilter(byte[] rowPrefix) { public Scan setRowPrefixFilter(byte[] rowPrefix) {
if (rowPrefix == null) { if (rowPrefix == null) {
setStartRow(HConstants.EMPTY_START_ROW); withStartRow(HConstants.EMPTY_START_ROW);
setStopRow(HConstants.EMPTY_END_ROW); setStopRow(HConstants.EMPTY_END_ROW);
} else { } else {
this.setStartRow(rowPrefix); this.withStartRow(rowPrefix);
this.setStopRow(ClientUtil.calculateTheClosestNextRowKeyForPrefix(rowPrefix)); this.setStopRow(ClientUtil.calculateTheClosestNextRowKeyForPrefix(rowPrefix));
} }
return this; return this;

View File

@ -194,11 +194,11 @@ public class TestScan {
@Test @Test
public void testSetStartRowAndSetStopRow() { public void testSetStartRowAndSetStopRow() {
Scan scan = new Scan(); Scan scan = new Scan();
scan.setStartRow(null); scan.withStartRow(null);
scan.setStartRow(new byte[1]); scan.withStartRow(new byte[1]);
scan.setStartRow(new byte[HConstants.MAX_ROW_LENGTH]); scan.withStartRow(new byte[HConstants.MAX_ROW_LENGTH]);
try { try {
scan.setStartRow(new byte[HConstants.MAX_ROW_LENGTH+1]); scan.withStartRow(new byte[HConstants.MAX_ROW_LENGTH+1]);
fail("should've thrown exception"); fail("should've thrown exception");
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
} catch (Exception e) { } catch (Exception e) {

View File

@ -799,7 +799,7 @@ public class AggregationClient implements Closeable {
Scan scan2 = new Scan(scan); Scan scan2 = new Scan(scan);
// inherit stop row from method parameter // inherit stop row from method parameter
if (startRow != null) { if (startRow != null) {
scan2.setStartRow(startRow); scan2.withStartRow(startRow);
} }
ResultScanner scanner = null; ResultScanner scanner = null;
try { try {

View File

@ -361,13 +361,13 @@ public class Export extends ExportProtos.ExportService implements RegionCoproces
byte[] originStartKey = scan.getStartRow(); byte[] originStartKey = scan.getStartRow();
if (originStartKey == null if (originStartKey == null
|| Bytes.compareTo(originStartKey, regionStartKey) < 0) { || Bytes.compareTo(originStartKey, regionStartKey) < 0) {
scan.setStartRow(regionStartKey); scan.withStartRow(regionStartKey);
} }
byte[] regionEndKey = region.getEndKey(); byte[] regionEndKey = region.getEndKey();
byte[] originEndKey = scan.getStopRow(); byte[] originEndKey = scan.getStopRow();
if (originEndKey == null if (originEndKey == null
|| Bytes.compareTo(originEndKey, regionEndKey) > 0) { || Bytes.compareTo(originEndKey, regionEndKey) > 0) {
scan.setStartRow(regionEndKey); scan.withStartRow(regionEndKey);
} }
return scan; return scan;
} }

View File

@ -1653,7 +1653,7 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase {
scan.setBatch(10000); scan.setBatch(10000);
if (cmd.hasOption("s")) if (cmd.hasOption("s"))
scan.setStartRow(Bytes.toBytesBinary(cmd.getOptionValue("s"))); scan.withStartRow(Bytes.toBytesBinary(cmd.getOptionValue("s")));
if (cmd.hasOption("e")) if (cmd.hasOption("e"))
scan.setStopRow(Bytes.toBytesBinary(cmd.getOptionValue("e"))); scan.setStopRow(Bytes.toBytesBinary(cmd.getOptionValue("e")));
@ -1711,7 +1711,7 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase {
abstract static class WalkerBase extends Configured{ abstract static class WalkerBase extends Configured{
protected static CINode findStartNode(Table table, byte[] startKey) throws IOException { protected static CINode findStartNode(Table table, byte[] startKey) throws IOException {
Scan scan = new Scan(); Scan scan = new Scan();
scan.setStartRow(startKey); scan.withStartRow(startKey);
scan.setBatch(1); scan.setBatch(1);
scan.addColumn(FAMILY_NAME, COLUMN_PREV); scan.addColumn(FAMILY_NAME, COLUMN_PREV);

View File

@ -125,7 +125,7 @@ public class IntegrationTestSendTraceRequests extends AbstractHBaseTool {
try (TraceScope scope = TraceUtil.createTrace("Scan")){ try (TraceScope scope = TraceUtil.createTrace("Scan")){
Table ht = util.getConnection().getTable(tableName); Table ht = util.getConnection().getTable(tableName);
Scan s = new Scan(); Scan s = new Scan();
s.setStartRow(Bytes.toBytes(rowKeyQueue.take())); s.withStartRow(Bytes.toBytes(rowKeyQueue.take()));
s.setBatch(7); s.setBatch(7);
rs = ht.getScanner(s); rs = ht.getScanner(s);
// Something to keep the jvm from removing the loop. // Something to keep the jvm from removing the loop.

View File

@ -121,7 +121,7 @@ public final class ExportUtils {
s.setCacheBlocks(false); s.setCacheBlocks(false);
// set Start and Stop row // set Start and Stop row
if (conf.get(TableInputFormat.SCAN_ROW_START) != null) { if (conf.get(TableInputFormat.SCAN_ROW_START) != null) {
s.setStartRow(Bytes.toBytesBinary(conf.get(TableInputFormat.SCAN_ROW_START))); s.withStartRow(Bytes.toBytesBinary(conf.get(TableInputFormat.SCAN_ROW_START)));
} }
if (conf.get(TableInputFormat.SCAN_ROW_STOP) != null) { if (conf.get(TableInputFormat.SCAN_ROW_STOP) != null) {
s.setStopRow(Bytes.toBytesBinary(conf.get(TableInputFormat.SCAN_ROW_STOP))); s.setStopRow(Bytes.toBytesBinary(conf.get(TableInputFormat.SCAN_ROW_STOP)));

View File

@ -195,7 +195,7 @@ public class HashTable extends Configured implements Tool {
scan.setMaxVersions(versions); scan.setMaxVersions(versions);
} }
if (!isTableStartRow(startRow)) { if (!isTableStartRow(startRow)) {
scan.setStartRow(startRow); scan.withStartRow(startRow);
} }
if (!isTableEndRow(stopRow)) { if (!isTableEndRow(stopRow)) {
scan.setStopRow(stopRow); scan.setStopRow(stopRow);

View File

@ -38,13 +38,13 @@ import org.apache.hadoop.hbase.client.Scan;
* List&lt;Scan&gt; scans = new ArrayList&lt;Scan&gt;(); * List&lt;Scan&gt; scans = new ArrayList&lt;Scan&gt;();
* *
* Scan scan1 = new Scan(); * Scan scan1 = new Scan();
* scan1.setStartRow(firstRow1); * scan1.withStartRow(firstRow1);
* scan1.setStopRow(lastRow1); * scan1.setStopRow(lastRow1);
* scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table1); * scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table1);
* scans.add(scan1); * scans.add(scan1);
* *
* Scan scan2 = new Scan(); * Scan scan2 = new Scan();
* scan2.setStartRow(firstRow2); * scan2.withStartRow(firstRow2);
* scan2.setStopRow(lastRow2); * scan2.setStopRow(lastRow2);
* scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table2); * scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table2);
* scans.add(scan2); * scans.add(scan2);

View File

@ -98,7 +98,7 @@ public abstract class MultiTableInputFormatBase extends
try { try {
Scan sc = tSplit.getScan(); Scan sc = tSplit.getScan();
sc.setStartRow(tSplit.getStartRow()); sc.withStartRow(tSplit.getStartRow());
sc.setStopRow(tSplit.getEndRow()); sc.setStopRow(tSplit.getEndRow());
trr.setScan(sc); trr.setScan(sc);
trr.setTable(table); trr.setTable(table);

View File

@ -171,7 +171,7 @@ public class RowCounter extends AbstractHBaseTool {
} }
if (size == 1) { if (size == 1) {
MultiRowRangeFilter.RowRange range = rowRangeList.get(0); MultiRowRangeFilter.RowRange range = rowRangeList.get(0);
scan.setStartRow(range.getStartRow()); //inclusive scan.withStartRow(range.getStartRow()); //inclusive
scan.setStopRow(range.getStopRow()); //exclusive scan.setStopRow(range.getStopRow()); //exclusive
} else if (size > 1) { } else if (size > 1) {
scan.setFilter(new MultiRowRangeFilter(rowRangeList)); scan.setFilter(new MultiRowRangeFilter(rowRangeList));

View File

@ -340,7 +340,7 @@ public class SyncTable extends Configured implements Tool {
private void syncRange(Context context, ImmutableBytesWritable startRow, private void syncRange(Context context, ImmutableBytesWritable startRow,
ImmutableBytesWritable stopRow) throws IOException, InterruptedException { ImmutableBytesWritable stopRow) throws IOException, InterruptedException {
Scan scan = sourceTableHash.initScan(); Scan scan = sourceTableHash.initScan();
scan.setStartRow(startRow.copyBytes()); scan.withStartRow(startRow.copyBytes());
scan.setStopRow(stopRow.copyBytes()); scan.setStopRow(stopRow.copyBytes());
ResultScanner sourceScanner = sourceTable.getScanner(scan); ResultScanner sourceScanner = sourceTable.getScanner(scan);
@ -681,7 +681,7 @@ public class SyncTable extends Configured implements Tool {
// the open hash range continues past the end of this region // the open hash range continues past the end of this region
// add a scan to complete the current hash range // add a scan to complete the current hash range
Scan scan = sourceTableHash.initScan(); Scan scan = sourceTableHash.initScan();
scan.setStartRow(splitEndRow); scan.withStartRow(splitEndRow);
if (nextSourceKey == null) { if (nextSourceKey == null) {
scan.setStopRow(sourceTableHash.stopRow); scan.setStopRow(sourceTableHash.stopRow);
} else { } else {

View File

@ -148,7 +148,7 @@ implements Configurable {
Scan scan = new Scan(); Scan scan = new Scan();
if (conf.get(SCAN_ROW_START) != null) { if (conf.get(SCAN_ROW_START) != null) {
scan.setStartRow(Bytes.toBytesBinary(conf.get(SCAN_ROW_START))); scan.withStartRow(Bytes.toBytesBinary(conf.get(SCAN_ROW_START)));
} }
if (conf.get(SCAN_ROW_STOP) != null) { if (conf.get(SCAN_ROW_STOP) != null) {

View File

@ -181,7 +181,7 @@ public abstract class TableInputFormatBase
final TableRecordReader trr = final TableRecordReader trr =
this.tableRecordReader != null ? this.tableRecordReader : new TableRecordReader(); this.tableRecordReader != null ? this.tableRecordReader : new TableRecordReader();
Scan sc = new Scan(this.scan); Scan sc = new Scan(this.scan);
sc.setStartRow(tSplit.getStartRow()); sc.withStartRow(tSplit.getStartRow());
sc.setStopRow(tSplit.getEndRow()); sc.setStopRow(tSplit.getEndRow());
trr.setScan(sc); trr.setScan(sc);
trr.setTable(getTable()); trr.setTable(getTable());

View File

@ -198,7 +198,7 @@ public class VerifyReplication extends Configured implements Tool {
TableName peerTableName = TableName.valueOf(peerName); TableName peerTableName = TableName.valueOf(peerName);
replicatedConnection = ConnectionFactory.createConnection(peerConf); replicatedConnection = ConnectionFactory.createConnection(peerConf);
replicatedTable = replicatedConnection.getTable(peerTableName); replicatedTable = replicatedConnection.getTable(peerTableName);
scan.setStartRow(value.getRow()); scan.withStartRow(value.getRow());
byte[] endRow = null; byte[] endRow = null;
if (tableSplit instanceof TableSnapshotInputFormat.TableSnapshotRegionSplit) { if (tableSplit instanceof TableSnapshotInputFormat.TableSnapshotRegionSplit) {
@ -511,7 +511,7 @@ public class VerifyReplication extends Configured implements Tool {
} }
private static void setStartAndStopRows(Scan scan, byte[] startPrefixRow, byte[] lastPrefixRow) { private static void setStartAndStopRows(Scan scan, byte[] startPrefixRow, byte[] lastPrefixRow) {
scan.setStartRow(startPrefixRow); scan.withStartRow(startPrefixRow);
byte[] stopRow = Bytes.add(Bytes.head(lastPrefixRow, lastPrefixRow.length - 1), byte[] stopRow = Bytes.add(Bytes.head(lastPrefixRow, lastPrefixRow.length - 1),
new byte[]{(byte) (lastPrefixRow[lastPrefixRow.length - 1] + 1)}); new byte[]{(byte) (lastPrefixRow[lastPrefixRow.length - 1] + 1)});
scan.setStopRow(stopRow); scan.setStopRow(stopRow);

View File

@ -238,7 +238,7 @@ public abstract class MultiTableInputFormatTestBase {
scan.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, Bytes.toBytes(tableName)); scan.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, Bytes.toBytes(tableName));
if (start != null) { if (start != null) {
scan.setStartRow(Bytes.toBytes(start)); scan.withStartRow(Bytes.toBytes(start));
} }
if (stop != null) { if (stop != null) {
scan.setStopRow(Bytes.toBytes(stop)); scan.setStopRow(Bytes.toBytes(stop));

View File

@ -169,7 +169,7 @@ public class TestTableInputFormat {
org.apache.hadoop.hbase.mapreduce.TableRecordReaderImpl trr = org.apache.hadoop.hbase.mapreduce.TableRecordReaderImpl trr =
new org.apache.hadoop.hbase.mapreduce.TableRecordReaderImpl(); new org.apache.hadoop.hbase.mapreduce.TableRecordReaderImpl();
Scan s = new Scan(); Scan s = new Scan();
s.setStartRow(Bytes.toBytes("aaa")); s.withStartRow(Bytes.toBytes("aaa"));
s.setStopRow(Bytes.toBytes("zzz")); s.setStopRow(Bytes.toBytes("zzz"));
s.addFamily(FAMILY); s.addFamily(FAMILY);
trr.setScan(s); trr.setScan(s);

View File

@ -140,7 +140,7 @@ public class TableResource extends ResourceBase {
byte[] prefixBytes = Bytes.toBytes(prefix); byte[] prefixBytes = Bytes.toBytes(prefix);
prefixFilter = new PrefixFilter(Bytes.toBytes(prefix)); prefixFilter = new PrefixFilter(Bytes.toBytes(prefix));
if (startRow.isEmpty()) { if (startRow.isEmpty()) {
tableScan.setStartRow(prefixBytes); tableScan.withStartRow(prefixBytes);
} }
} }
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
@ -154,7 +154,7 @@ public class TableResource extends ResourceBase {
tableScan.setMaxVersions(maxVersions); tableScan.setMaxVersions(maxVersions);
tableScan.setTimeRange(startTime, endTime); tableScan.setTimeRange(startTime, endTime);
if (!startRow.isEmpty()) { if (!startRow.isEmpty()) {
tableScan.setStartRow(Bytes.toBytes(startRow)); tableScan.withStartRow(Bytes.toBytes(startRow));
} }
tableScan.setStopRow(Bytes.toBytes(endRow)); tableScan.setStopRow(Bytes.toBytes(endRow));
for (String col : column) { for (String col : column) {

View File

@ -1317,7 +1317,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
TEST_UTIL.flush(); TEST_UTIL.flush();
Scan scan = new Scan(); Scan scan = new Scan();
scan.setStartRow(Bytes.toBytes(1)); scan.withStartRow(Bytes.toBytes(1));
scan.setStopRow(Bytes.toBytes(3)); scan.setStopRow(Bytes.toBytes(3));
scan.addColumn(FAMILY, FAMILY); scan.addColumn(FAMILY, FAMILY);
scan.setFilter(new RowFilter(CompareOperator.NOT_EQUAL, scan.setFilter(new RowFilter(CompareOperator.NOT_EQUAL,
@ -2114,7 +2114,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan = new Scan(); scan = new Scan();
scan.setSmall(small); scan.setSmall(small);
scan.setReversed(true); scan.setReversed(true);
scan.setStartRow(Bytes.toBytes("002")); scan.withStartRow(Bytes.toBytes("002"));
try (ResultScanner scanner = table.getScanner(scan)) { try (ResultScanner scanner = table.getScanner(scan)) {
int count = 0; int count = 0;
byte[] lastRow = null; byte[] lastRow = null;
@ -2135,7 +2135,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan = new Scan(); scan = new Scan();
scan.setSmall(small); scan.setSmall(small);
scan.setReversed(true); scan.setReversed(true);
scan.setStartRow(Bytes.toBytes("002")); scan.withStartRow(Bytes.toBytes("002"));
scan.setStopRow(Bytes.toBytes("000")); scan.setStopRow(Bytes.toBytes("000"));
try (ResultScanner scanner = table.getScanner(scan)) { try (ResultScanner scanner = table.getScanner(scan)) {
int count = 0; int count = 0;
@ -2157,7 +2157,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan = new Scan(); scan = new Scan();
scan.setSmall(small); scan.setSmall(small);
scan.setReversed(true); scan.setReversed(true);
scan.setStartRow(Bytes.toBytes("001")); scan.withStartRow(Bytes.toBytes("001"));
try (ResultScanner scanner = table.getScanner(scan)) { try (ResultScanner scanner = table.getScanner(scan)) {
int count = 0; int count = 0;
byte[] lastRow = null; byte[] lastRow = null;
@ -2178,7 +2178,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan = new Scan(); scan = new Scan();
scan.setSmall(small); scan.setSmall(small);
scan.setReversed(true); scan.setReversed(true);
scan.setStartRow(Bytes.toBytes("000")); scan.withStartRow(Bytes.toBytes("000"));
try (ResultScanner scanner = table.getScanner(scan)) { try (ResultScanner scanner = table.getScanner(scan)) {
int count = 0; int count = 0;
byte[] lastRow = null; byte[] lastRow = null;
@ -2199,7 +2199,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan = new Scan(); scan = new Scan();
scan.setSmall(small); scan.setSmall(small);
scan.setReversed(true); scan.setReversed(true);
scan.setStartRow(Bytes.toBytes("006")); scan.withStartRow(Bytes.toBytes("006"));
scan.setStopRow(Bytes.toBytes("002")); scan.setStopRow(Bytes.toBytes("002"));
try (ResultScanner scanner = table.getScanner(scan)) { try (ResultScanner scanner = table.getScanner(scan)) {
int count = 0; int count = 0;

View File

@ -289,7 +289,7 @@ public class TestFilter {
Scan s = new Scan(); Scan s = new Scan();
// set a start row // set a start row
s.setStartRow(ROWS_FOUR[1]); s.withStartRow(ROWS_FOUR[1]);
RegionScanner scanner = region.getScanner(s); RegionScanner scanner = region.getScanner(s);
// reseek to row three. // reseek to row three.

View File

@ -156,7 +156,7 @@ public class TestFilterListOrOperatorWithBlkCnt {
Scan scan = new Scan(); Scan scan = new Scan();
scan.setMaxVersions(); scan.setMaxVersions();
if(!Bytes.toString(startRow).isEmpty()) { if(!Bytes.toString(startRow).isEmpty()) {
scan.setStartRow(startRow); scan.withStartRow(startRow);
} }
if(!Bytes.toString(stopRow).isEmpty()) { if(!Bytes.toString(stopRow).isEmpty()) {
scan.setStopRow(stopRow); scan.setStopRow(stopRow);

View File

@ -215,7 +215,7 @@ public class TestSeekOptimizations {
qualSet.add(qualStr); qualSet.add(qualStr);
} }
scan.setMaxVersions(maxVersions); scan.setMaxVersions(maxVersions);
scan.setStartRow(rowBytes(startRow)); scan.withStartRow(rowBytes(startRow));
// Adjust for the fact that for multi-row queries the end row is exclusive. // Adjust for the fact that for multi-row queries the end row is exclusive.
{ {

View File

@ -452,7 +452,7 @@ public class TestTags {
increment.setAttribute("visibility", Bytes.toBytes("tag2")); increment.setAttribute("visibility", Bytes.toBytes("tag2"));
table.increment(increment); table.increment(increment);
TestCoprocessorForTags.checkTagPresence = true; TestCoprocessorForTags.checkTagPresence = true;
scanner = table.getScanner(new Scan().setStartRow(row2)); scanner = table.getScanner(new Scan().withStartRow(row2));
result = scanner.next(); result = scanner.next();
kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q)); kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q));
tags = TestCoprocessorForTags.tags; tags = TestCoprocessorForTags.tags;
@ -472,7 +472,7 @@ public class TestTags {
append.addColumn(f, q, Bytes.toBytes("b")); append.addColumn(f, q, Bytes.toBytes("b"));
table.append(append); table.append(append);
TestCoprocessorForTags.checkTagPresence = true; TestCoprocessorForTags.checkTagPresence = true;
scanner = table.getScanner(new Scan().setStartRow(row3)); scanner = table.getScanner(new Scan().withStartRow(row3));
result = scanner.next(); result = scanner.next();
kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q)); kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q));
tags = TestCoprocessorForTags.tags; tags = TestCoprocessorForTags.tags;
@ -486,7 +486,7 @@ public class TestTags {
append.setAttribute("visibility", Bytes.toBytes("tag2")); append.setAttribute("visibility", Bytes.toBytes("tag2"));
table.append(append); table.append(append);
TestCoprocessorForTags.checkTagPresence = true; TestCoprocessorForTags.checkTagPresence = true;
scanner = table.getScanner(new Scan().setStartRow(row3)); scanner = table.getScanner(new Scan().withStartRow(row3));
result = scanner.next(); result = scanner.next();
kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q)); kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q));
tags = TestCoprocessorForTags.tags; tags = TestCoprocessorForTags.tags;
@ -510,7 +510,7 @@ public class TestTags {
append.setAttribute("visibility", Bytes.toBytes("tag2")); append.setAttribute("visibility", Bytes.toBytes("tag2"));
table.append(append); table.append(append);
TestCoprocessorForTags.checkTagPresence = true; TestCoprocessorForTags.checkTagPresence = true;
scanner = table.getScanner(new Scan().setStartRow(row4)); scanner = table.getScanner(new Scan().withStartRow(row4));
result = scanner.next(); result = scanner.next();
kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q)); kv = KeyValueUtil.ensureKeyValue(result.getColumnLatestCell(f, q));
tags = TestCoprocessorForTags.tags; tags = TestCoprocessorForTags.tags;

View File

@ -241,7 +241,7 @@ public class TestCellACLs extends SecureTestUtil {
@Override @Override
public List<Cell> run() throws Exception { public List<Cell> run() throws Exception {
Scan scan = new Scan(); Scan scan = new Scan();
scan.setStartRow(TEST_ROW); scan.withStartRow(TEST_ROW);
scan.setStopRow(Bytes.add(TEST_ROW, new byte[]{ 0 } )); scan.setStopRow(Bytes.add(TEST_ROW, new byte[]{ 0 } ));
scan.addFamily(TEST_FAMILY); scan.addFamily(TEST_FAMILY);
Connection connection = ConnectionFactory.createConnection(conf); Connection connection = ConnectionFactory.createConnection(conf);

View File

@ -973,7 +973,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
@Override @Override
public List<Cell> run() throws Exception { public List<Cell> run() throws Exception {
Scan scan = new Scan(); Scan scan = new Scan();
scan.setStartRow(TEST_ROW); scan.withStartRow(TEST_ROW);
scan.setStopRow(Bytes.add(TEST_ROW, new byte[]{ 0 } )); scan.setStopRow(Bytes.add(TEST_ROW, new byte[]{ 0 } ));
scan.addFamily(TEST_FAMILY); scan.addFamily(TEST_FAMILY);
Connection connection = ConnectionFactory.createConnection(conf); Connection connection = ConnectionFactory.createConnection(conf);

View File

@ -883,7 +883,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb
Scan scan = new Scan(); Scan scan = new Scan();
addAttributes(scan, attributes); addAttributes(scan, attributes);
if (tScan.isSetStartRow()) { if (tScan.isSetStartRow()) {
scan.setStartRow(tScan.getStartRow()); scan.withStartRow(tScan.getStartRow());
} }
if (tScan.isSetStopRow()) { if (tScan.isSetStopRow()) {
scan.setStopRow(tScan.getStopRow()); scan.setStopRow(tScan.getStopRow());
@ -1161,7 +1161,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb
Scan scan = new Scan(row); Scan scan = new Scan(row);
scan.setReversed(true); scan.setReversed(true);
scan.addFamily(family); scan.addFamily(family);
scan.setStartRow(row); scan.withStartRow(row);
try (Table table = getTable(tableName); try (Table table = getTable(tableName);
ResultScanner scanner = table.getScanner(scan)) { ResultScanner scanner = table.getScanner(scan)) {
return scanner.next(); return scanner.next();

View File

@ -513,7 +513,7 @@ public final class ThriftUtilities {
Scan out = new Scan(); Scan out = new Scan();
if (in.isSetStartRow()) { if (in.isSetStartRow()) {
out.setStartRow(in.getStartRow()); out.withStartRow(in.getStartRow());
} }
if (in.isSetStopRow()) { if (in.isSetStopRow()) {
out.setStopRow(in.getStopRow()); out.setStopRow(in.getStopRow());