HBASE-23843 Removed deprecated Scan(byte[]) from Scan

Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Jan Hentschel 2020-04-02 11:44:34 +02:00 committed by GitHub
parent 4ea819b8f2
commit 4ddf55d20a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 97 additions and 112 deletions

View File

@ -179,21 +179,6 @@ public class Scan extends Query {
*/
public Scan() {}
/**
* Create a Scan operation starting at the specified row.
* <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
* @deprecated since 2.0.0 and will be removed in 3.0.0. Use
* {@code new Scan().withStartRow(startRow)} instead.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-17320">HBASE-17320</a>
*/
@Deprecated
public Scan(byte[] startRow) {
withStartRow(startRow);
}
/**
* Creates a new instance of this class while copying all values.
*

View File

@ -289,7 +289,7 @@ public class TestOperation {
@Test
public void testOperationJSON() throws IOException {
// produce a Scan Operation
Scan scan = new Scan(ROW);
Scan scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
// get its JSON representation, and parse it
String json = scan.toJSON();

View File

@ -297,7 +297,7 @@ public class MultiThreadedClientExample extends Configured implements Tool {
int toRead = 100;
try (Table t = connection.getTable(tableName)) {
byte[] rk = Bytes.toBytes(ThreadLocalRandom.current().nextLong());
Scan s = new Scan(rk);
Scan s = new Scan().withStartRow(rk);
// This filter will keep the values from being sent accross the wire.
// This is good for counting or other scans that are checking for

View File

@ -85,7 +85,7 @@ public class TableRecordReaderImpl {
LOG.debug("TIFB.restart, firstRow: " +
Bytes.toStringBinary(firstRow) + ", no endRow");
Scan scan = new Scan(firstRow);
Scan scan = new Scan().withStartRow(firstRow);
TableInputFormat.addColumns(scan, trrInputColumns);
scan.setFilter(trrRowFilter);
this.scanner = this.htable.getScanner(scan);

View File

@ -75,7 +75,7 @@ public class ScannerResultGenerator extends ResultGenerator {
if (rowspec.hasEndRow()) {
scan = new Scan().withStartRow(rowspec.getStartRow()).withStopRow(rowspec.getEndRow());
} else {
scan = new Scan(rowspec.getStartRow());
scan = new Scan().withStartRow(rowspec.getStartRow());
}
if (rowspec.hasColumns()) {
byte[][] columns = rowspec.getColumns();

View File

@ -976,7 +976,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
@Override
void testRow(final int i) throws IOException {
Scan scan = new Scan(getRandomRow(this.rand, this.totalRows));
Scan scan = new Scan().withStartRow(getRandomRow(this.rand, this.totalRows));
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
scan.setFilter(new WhileMatchFilter(new PageFilter(120)));
ResultScanner s = this.table.getScanner(scan);
@ -1141,7 +1141,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
@Override
void testRow(final int i) throws IOException {
if (this.testScanner == null) {
Scan scan = new Scan(format(this.startRow));
Scan scan = new Scan().withStartRow(format(this.startRow));
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
this.testScanner = table.getScanner(scan);
}

View File

@ -489,7 +489,7 @@ public class TestScannersWithFilters {
// Now use start row with inclusive stop filter
expectedRows = numRows / 2;
s = new Scan(Bytes.toBytes("testRowOne-0"));
s = new Scan().withStartRow(Bytes.toBytes("testRowOne-0"));
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowOne-3")));
verifyScan(s, expectedRows, expectedKeys);
@ -504,7 +504,7 @@ public class TestScannersWithFilters {
// Now use start row with inclusive stop filter
expectedRows = numRows / 2;
s = new Scan(Bytes.toBytes("testRowTwo-0"));
s = new Scan().withStartRow(Bytes.toBytes("testRowTwo-0"));
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowTwo-3")));
verifyScan(s, expectedRows, expectedKeys);
}

View File

@ -4318,7 +4318,7 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
}
public Result getClosestRowBefore(Region r, byte[] row, byte[] family) throws IOException {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.setSmall(true);
scan.setCaching(1);
scan.setReversed(true);

View File

@ -370,7 +370,7 @@ public class TestSerialization {
}
// Test filters are serialized properly.
scan = new Scan(startRow);
scan = new Scan().withStartRow(startRow);
final String name = "testScan";
byte [] prefix = Bytes.toBytes(name);
scan.setFilter(new PrefixFilter(prefix));

View File

@ -201,7 +201,7 @@ public class TimestampTestBase {
*/
public static int assertScanContentTimestamp(final Table in, final long ts)
throws IOException {
Scan scan = new Scan(HConstants.EMPTY_START_ROW);
Scan scan = new Scan().withStartRow(HConstants.EMPTY_START_ROW);
scan.addFamily(FAMILY_NAME);
scan.setTimeRange(0, ts);
ResultScanner scanner = in.getScanner(scan);

View File

@ -245,7 +245,7 @@ class FromClientSideBase {
assertTrue(key != null && key.length > 0 &&
Bytes.BYTES_COMPARATOR.compare(key, new byte [] {'a', 'a', 'a'}) >= 0);
LOG.info("Key=" + Bytes.toString(key));
Scan s = startRow == null? new Scan(): new Scan(startRow);
Scan s = startRow == null? new Scan(): new Scan().withStartRow(startRow);
Filter f = new RowFilter(op, new BinaryComparator(key));
f = new WhileMatchFilter(f);
s.setFilter(f);
@ -584,7 +584,7 @@ class FromClientSideBase {
protected void scanVersionRangeAndVerifyGreaterThan(Table ht, byte [] row,
byte [] family, byte [] qualifier, long [] stamps, byte [][] values,
int start, int end) throws IOException {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.addColumn(family, qualifier);
scan.readVersions(Integer.MAX_VALUE);
scan.setTimeRange(stamps[start+1], Long.MAX_VALUE);
@ -594,7 +594,7 @@ class FromClientSideBase {
protected void scanVersionRangeAndVerify(Table ht, byte [] row, byte [] family,
byte [] qualifier, long [] stamps, byte [][] values, int start, int end) throws IOException {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.addColumn(family, qualifier);
scan.readVersions(Integer.MAX_VALUE);
scan.setTimeRange(stamps[start], stamps[end]+1);
@ -604,7 +604,7 @@ class FromClientSideBase {
protected void scanAllVersionsAndVerify(Table ht, byte [] row, byte [] family,
byte [] qualifier, long [] stamps, byte [][] values, int start, int end) throws IOException {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.addColumn(family, qualifier);
scan.readVersions(Integer.MAX_VALUE);
Result result = getSingleScanResult(ht, scan);
@ -633,7 +633,7 @@ class FromClientSideBase {
protected void scanVersionAndVerify(Table ht, byte [] row, byte [] family,
byte [] qualifier, long stamp, byte [] value) throws Exception {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.addColumn(family, qualifier);
scan.setTimestamp(stamp);
scan.readVersions(Integer.MAX_VALUE);
@ -643,7 +643,7 @@ class FromClientSideBase {
protected void scanVersionAndVerifyMissing(Table ht, byte [] row,
byte [] family, byte [] qualifier, long stamp) throws Exception {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.addColumn(family, qualifier);
scan.setTimestamp(stamp);
scan.readVersions(Integer.MAX_VALUE);
@ -908,7 +908,7 @@ class FromClientSideBase {
// Scan around inserted columns
scan = new Scan(ROWS[1]);
scan = new Scan().withStartRow(ROWS[1]);
result = getSingleScanResult(ht, scan);
assertNullResult(result);
@ -986,7 +986,7 @@ class FromClientSideBase {
assertSingleResult(result, ROWS[ROWIDX], FAMILIES[FAMILYIDX],
QUALIFIERS[QUALIFIERIDX], VALUES[VALUEIDX]);
scan = new Scan(ROWS[ROWIDX]);
scan = new Scan().withStartRow(ROWS[ROWIDX]);
result = getSingleScanResult(ht, scan);
assertSingleResult(result, ROWS[ROWIDX], FAMILIES[FAMILYIDX],
QUALIFIERS[QUALIFIERIDX], VALUES[VALUEIDX]);
@ -1063,7 +1063,7 @@ class FromClientSideBase {
protected void scanVerifySingleEmpty(Table ht, byte [][] ROWS, int ROWIDX, byte [][] FAMILIES,
int FAMILYIDX, byte [][] QUALIFIERS, int QUALIFIERIDX) throws Exception {
Scan scan = new Scan(ROWS[ROWIDX+1]);
Scan scan = new Scan().withStartRow(ROWS[ROWIDX+1]);
Result result = getSingleScanResult(ht, scan);
assertNullResult(result);

View File

@ -190,7 +190,7 @@ public class TestFromClientSide extends FromClientSideBase {
Result r = h.get(g);
assertArrayEquals(T2, r.getValue(FAMILY, C0));
Scan s = new Scan(T1);
Scan s = new Scan().withStartRow(T1);
s.setTimeRange(0, ts + 3);
s.readAllVersions();
ResultScanner scanner = h.getScanner(s);
@ -199,7 +199,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertArrayEquals(T1, CellUtil.cloneValue(kvs[1]));
scanner.close();
s = new Scan(T1);
s = new Scan().withStartRow(T1);
s.setRaw(true);
s.readAllVersions();
scanner = h.getScanner(s);
@ -548,7 +548,7 @@ public class TestFromClientSide extends FromClientSideBase {
result = getSingleScanResult(ht, scan);
assertNullResult(result);
scan = new Scan(ROWS[0]);
scan = new Scan().withStartRow(ROWS[0]);
result = getSingleScanResult(ht, scan);
assertNullResult(result);
@ -590,7 +590,7 @@ public class TestFromClientSide extends FromClientSideBase {
// Try to scan empty rows around it
scan = new Scan(ROWS[3]);
scan = new Scan().withStartRow(ROWS[3]);
result = getSingleScanResult(ht, scan);
assertNullResult(result);
@ -1125,7 +1125,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
Scan scan = new Scan(ROW);
Scan scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
@ -1162,7 +1162,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
@ -1190,7 +1190,7 @@ public class TestFromClientSide extends FromClientSideBase {
new byte[][] { VALUES[1], VALUES[2], VALUES[3], VALUES[4], VALUES[5], VALUES[6], VALUES[7],
VALUES[8] }, 0, 7);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readAllVersions();
result = getSingleScanResult(ht, scan);
@ -1209,7 +1209,7 @@ public class TestFromClientSide extends FromClientSideBase {
new byte[][] { VALUES[1], VALUES[2], VALUES[3], VALUES[4], VALUES[5], VALUES[6], VALUES[7],
VALUES[8] }, 0, 7);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.readAllVersions();
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
@ -1256,7 +1256,7 @@ public class TestFromClientSide extends FromClientSideBase {
new byte[][] { VALUES[3], VALUES[4], VALUES[5], VALUES[6], VALUES[7], VALUES[8], VALUES[9],
VALUES[11], VALUES[13], VALUES[15] }, 0, 9);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1283,7 +1283,7 @@ public class TestFromClientSide extends FromClientSideBase {
new byte[][] { VALUES[1], VALUES[2], VALUES[3], VALUES[4], VALUES[5], VALUES[6], VALUES[8],
VALUES[9], VALUES[13], VALUES[15] }, 0, 9);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1339,14 +1339,14 @@ public class TestFromClientSide extends FromClientSideBase {
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { STAMPS[1] },
new byte[][] { VALUES[1] }, 0, 0);
Scan scan = new Scan(ROW);
Scan scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { STAMPS[1] },
new byte[][] { VALUES[1] }, 0, 0);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addFamily(FAMILIES[0]);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1371,7 +1371,7 @@ public class TestFromClientSide extends FromClientSideBase {
new long[] { STAMPS[1], STAMPS[2], STAMPS[3] },
new byte[][] { VALUES[1], VALUES[2], VALUES[3] }, 0, 2);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILIES[1], QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1379,7 +1379,7 @@ public class TestFromClientSide extends FromClientSideBase {
new long[] { STAMPS[1], STAMPS[2], STAMPS[3] },
new byte[][] { VALUES[1], VALUES[2], VALUES[3] }, 0, 2);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addFamily(FAMILIES[1]);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1405,7 +1405,7 @@ public class TestFromClientSide extends FromClientSideBase {
new long[] { STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6] },
new byte[][] { VALUES[2], VALUES[3], VALUES[4], VALUES[5], VALUES[6] }, 0, 4);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILIES[2], QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1413,7 +1413,7 @@ public class TestFromClientSide extends FromClientSideBase {
new long[] { STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6] },
new byte[][] { VALUES[2], VALUES[3], VALUES[4], VALUES[5], VALUES[6] }, 0, 4);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addFamily(FAMILIES[2]);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1444,12 +1444,12 @@ public class TestFromClientSide extends FromClientSideBase {
result = ht.get(get);
assertEquals("Expected 9 keys but received " + result.size(), 9, result.size());
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals("Expected 9 keys but received " + result.size(), 9, result.size());
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.readVersions(Integer.MAX_VALUE);
scan.addFamily(FAMILIES[0]);
scan.addFamily(FAMILIES[1]);
@ -1457,7 +1457,7 @@ public class TestFromClientSide extends FromClientSideBase {
result = getSingleScanResult(ht, scan);
assertEquals("Expected 9 keys but received " + result.size(), 9, result.size());
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.readVersions(Integer.MAX_VALUE);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.addColumn(FAMILIES[1], QUALIFIER);
@ -1665,7 +1665,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { ts[1] },
new byte[][] { VALUES[1] }, 0, 0);
Scan scan = new Scan(ROW);
Scan scan = new Scan().withStartRow(ROW);
scan.addFamily(FAMILIES[0]);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1693,7 +1693,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { ts[1], ts[2], ts[3] },
new byte[][] { VALUES[1], VALUES[2], VALUES[3] }, 0, 2);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1730,7 +1730,7 @@ public class TestFromClientSide extends FromClientSideBase {
// The Scanner returns the previous values, the expected-naive-unexpected behavior
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addFamily(FAMILIES[0]);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -1792,7 +1792,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertNResult(result, ROWS[0], FAMILIES[1], QUALIFIER, new long[] { ts[0], ts[1] },
new byte[][] { VALUES[0], VALUES[1] }, 0, 1);
scan = new Scan(ROWS[0]);
scan = new Scan().withStartRow(ROWS[0]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.readVersions(Integer.MAX_VALUE);
@ -1808,7 +1808,7 @@ public class TestFromClientSide extends FromClientSideBase {
result = ht.get(get);
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
scan = new Scan(ROWS[1]);
scan = new Scan().withStartRow(ROWS[1]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.readVersions(Integer.MAX_VALUE);
@ -1824,7 +1824,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertNResult(result, ROWS[2], FAMILIES[2], QUALIFIER, new long[] { ts[2] },
new byte[][] { VALUES[2] }, 0, 0);
scan = new Scan(ROWS[2]);
scan = new Scan().withStartRow(ROWS[2]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.readVersions(Integer.MAX_VALUE);
@ -1862,7 +1862,7 @@ public class TestFromClientSide extends FromClientSideBase {
result = ht.get(get);
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
scan = new Scan(ROWS[3]);
scan = new Scan().withStartRow(ROWS[3]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.readVersions(Integer.MAX_VALUE);

View File

@ -559,7 +559,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
Scan scan = new Scan(ROW);
Scan scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
@ -596,7 +596,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
@ -624,7 +624,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
new byte[][] { VALUES[2], VALUES[3], VALUES[14], VALUES[5], VALUES[6], VALUES[7],
VALUES[8] }, 0, 6);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(7);
result = getSingleScanResult(ht, scan);
@ -641,7 +641,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
new byte[][] { VALUES[2], VALUES[3], VALUES[14], VALUES[5], VALUES[6], VALUES[7],
VALUES[8] }, 0, 6);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.readVersions(7);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
@ -687,7 +687,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
new byte[][] { VALUES[3], VALUES[14], VALUES[5], VALUES[6], VALUES[7], VALUES[8], VALUES[9],
VALUES[11], VALUES[13], VALUES[15] }, 0, 9);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
@ -714,7 +714,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
new byte[][] { VALUES[1], VALUES[2], VALUES[3], VALUES[14], VALUES[5], VALUES[6], VALUES[8],
VALUES[9], VALUES[13], VALUES[15] }, 0, 9);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);

View File

@ -233,7 +233,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
}
private Result getReverseScanResult(Table table, byte[] row) throws IOException {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.setSmall(true);
scan.setReversed(true);
scan.setCaching(1);
@ -1446,7 +1446,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
table.put(p);
int versions = 4;
Scan s = new Scan(row);
Scan s = new Scan().withStartRow(row);
// get all the possible versions
s.readAllVersions();
s.setRaw(true);
@ -1717,7 +1717,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
Result result = getSingleScanResult(ht, scan);
assertNullResult(result);
scan = new Scan(ROWS[0]);
scan = new Scan().withStartRow(ROWS[0]);
scan.setReversed(true);
result = getSingleScanResult(ht, scan);
assertNullResult(result);
@ -1763,7 +1763,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
// Try to scan empty rows around it
// Introduced MemStore#shouldSeekForReverseScan to fix the following
scan = new Scan(ROWS[1]);
scan = new Scan().withStartRow(ROWS[1]);
scan.setReversed(true);
result = getSingleScanResult(ht, scan);
assertNullResult(result);
@ -1828,7 +1828,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
delete.addFamily(FAMILIES[0], ts[0]);
ht.delete(delete);
Scan scan = new Scan(ROW);
Scan scan = new Scan().withStartRow(ROW);
scan.setReversed(true);
scan.addFamily(FAMILIES[0]);
scan.readVersions(Integer.MAX_VALUE);
@ -1850,7 +1850,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
delete.addColumn(FAMILIES[0], QUALIFIER); // ts[4]
ht.delete(delete);
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.setReversed(true);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.readVersions(Integer.MAX_VALUE);
@ -1879,7 +1879,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
// The Scanner returns the previous values, the expected-naive-unexpected
// behavior
scan = new Scan(ROW);
scan = new Scan().withStartRow(ROW);
scan.setReversed(true);
scan.addFamily(FAMILIES[0]);
scan.readVersions(Integer.MAX_VALUE);
@ -1925,7 +1925,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
delete.addColumn(FAMILIES[2], QUALIFIER);
ht.delete(delete);
scan = new Scan(ROWS[0]);
scan = new Scan().withStartRow(ROWS[0]);
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
@ -1935,7 +1935,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
assertNResult(result, ROWS[0], FAMILIES[1], QUALIFIER, new long[]{ts[0],
ts[1]}, new byte[][]{VALUES[0], VALUES[1]}, 0, 1);
scan = new Scan(ROWS[1]);
scan = new Scan().withStartRow(ROWS[1]);
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
@ -1943,7 +1943,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
result = getSingleScanResult(ht, scan);
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
scan = new Scan(ROWS[2]);
scan = new Scan().withStartRow(ROWS[2]);
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
@ -1968,7 +1968,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
put.addColumn(FAMILIES[2], QUALIFIER, VALUES[2]);
ht.put(put);
scan = new Scan(ROWS[4]);
scan = new Scan().withStartRow(ROWS[4]);
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);

View File

@ -95,7 +95,7 @@ public class TestGetScanColumnsWithNewVersionBehavior {
assertArrayEquals(expected, getResult.rawCells());
// check scan request
Scan scan = new Scan(ROW);
Scan scan = new Scan().withStartRow(ROW);
scan.addColumn(CF, COLA);
scan.addColumn(CF, COLC);
ResultScanner scanner = t.getScanner(scan);

View File

@ -648,7 +648,7 @@ public class TestScannersFromClientSide {
Delete delete = new Delete(ROW);
delete.addFamilyVersion(FAMILY, 0L);
table.delete(delete);
Scan scan = new Scan(ROW).setRaw(true);
Scan scan = new Scan().withStartRow(ROW).setRaw(true);
ResultScanner scanner = table.getScanner(scan);
int count = 0;
while (scanner.next() != null) {

View File

@ -723,7 +723,7 @@ public class TestFilter {
// Now use start row with inclusive stop filter
expectedRows = this.numRows / 2;
s = new Scan(Bytes.toBytes("testRowOne-0"));
s = new Scan().withStartRow(Bytes.toBytes("testRowOne-0"));
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowOne-3")));
verifyScan(s, expectedRows, expectedKeys);
@ -738,7 +738,7 @@ public class TestFilter {
// Now use start row with inclusive stop filter
expectedRows = this.numRows / 2;
s = new Scan(Bytes.toBytes("testRowTwo-0"));
s = new Scan().withStartRow(Bytes.toBytes("testRowTwo-0"));
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowTwo-3")));
verifyScan(s, expectedRows, expectedKeys);
@ -759,7 +759,7 @@ public class TestFilter {
// Now use start row with inclusive stop filter
expectedRows = this.numRows / 2;
s = new Scan(Bytes.toBytes("testRowOne-3"));
s = new Scan().withStartRow(Bytes.toBytes("testRowOne-3"));
s.setReversed(true);
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowOne-0")));
verifyScan(s, expectedRows, expectedKeys);
@ -776,7 +776,7 @@ public class TestFilter {
// Now use start row with inclusive stop filter
expectedRows = this.numRows / 2;
s = new Scan(Bytes.toBytes("testRowTwo-3"));
s = new Scan().withStartRow(Bytes.toBytes("testRowTwo-3"));
s.setReversed(true);
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowTwo-0")));
verifyScan(s, expectedRows, expectedKeys);

View File

@ -116,7 +116,7 @@ public class TestLoadAndSwitchEncodeOnDisk extends TestMiniClusterLoadSequential
}
for (HRegionLocation e: regions) {
byte [] startkey = e.getRegion().getStartKey();
Scan s = new Scan(startkey);
Scan s = new Scan().withStartRow(startkey);
ResultScanner scanner = t.getScanner(s);
Result r = scanner.next();
org.junit.Assert.assertTrue(r != null && r.size() > 0);

View File

@ -572,7 +572,7 @@ public class TestAtomicOperation {
region.mutateRowsWithLocks(mrm, rowsToLock, HConstants.NO_NONCE, HConstants.NO_NONCE);
op ^= true;
// check: should always see exactly one column
Scan s = new Scan(row);
Scan s = new Scan().withStartRow(row);
RegionScanner rs = region.getScanner(s);
List<Cell> r = new ArrayList<>();
while (rs.next(r))

View File

@ -2741,7 +2741,7 @@ public class TestHRegion {
assertArrayEquals(value2, r.getValue(fam1, qual1));
// next:
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.addColumn(fam1, qual1);
InternalScanner s = region.getScanner(scan);
@ -3140,7 +3140,7 @@ public class TestHRegion {
expected.add(kv13);
expected.add(kv12);
Scan scan = new Scan(row1);
Scan scan = new Scan().withStartRow(row1);
scan.addColumn(fam1, qf1);
scan.readVersions(MAX_VERSIONS);
List<Cell> actual = new ArrayList<>();
@ -3196,7 +3196,7 @@ public class TestHRegion {
expected.add(kv23);
expected.add(kv22);
Scan scan = new Scan(row1);
Scan scan = new Scan().withStartRow(row1);
scan.addColumn(fam1, qf1);
scan.addColumn(fam1, qf2);
scan.readVersions(MAX_VERSIONS);
@ -3272,7 +3272,7 @@ public class TestHRegion {
expected.add(kv23);
expected.add(kv22);
Scan scan = new Scan(row1);
Scan scan = new Scan().withStartRow(row1);
scan.addColumn(fam1, qf1);
scan.addColumn(fam1, qf2);
int versions = 3;
@ -3329,7 +3329,7 @@ public class TestHRegion {
expected.add(kv23);
expected.add(kv22);
Scan scan = new Scan(row1);
Scan scan = new Scan().withStartRow(row1);
scan.addFamily(fam1);
scan.readVersions(MAX_VERSIONS);
List<Cell> actual = new ArrayList<>();
@ -3384,7 +3384,7 @@ public class TestHRegion {
expected.add(kv23);
expected.add(kv22);
Scan scan = new Scan(row1);
Scan scan = new Scan().withStartRow(row1);
scan.addFamily(fam1);
scan.readVersions(MAX_VERSIONS);
List<Cell> actual = new ArrayList<>();
@ -3500,7 +3500,7 @@ public class TestHRegion {
expected.add(kv23);
expected.add(kv22);
Scan scan = new Scan(row1);
Scan scan = new Scan().withStartRow(row1);
int versions = 3;
scan.readVersions(versions);
List<Cell> actual = new ArrayList<>();
@ -5218,7 +5218,7 @@ public class TestHRegion {
put.add(kv3);
region.put(put);
Scan scan = new Scan(rowC);
Scan scan = new Scan().withStartRow(rowC);
scan.readVersions(5);
scan.setReversed(true);
InternalScanner scanner = region.getScanner(scan);
@ -5272,7 +5272,7 @@ public class TestHRegion {
put.add(kv3);
region.put(put);
Scan scan = new Scan(rowD);
Scan scan = new Scan().withStartRow(rowD);
List<Cell> currRow = new ArrayList<>();
scan.setReversed(true);
scan.readVersions(5);
@ -5604,7 +5604,7 @@ public class TestHRegion {
put.add(kv5_2_2);
region.put(put);
// scan range = ["row4", min), skip the max "row5"
Scan scan = new Scan(row4);
Scan scan = new Scan().withStartRow(row4);
scan.readVersions(5);
scan.setBatch(3);
scan.setReversed(true);
@ -5707,7 +5707,7 @@ public class TestHRegion {
put.add(kv4);
region.put(put);
// scan range = ["row4", min)
Scan scan = new Scan(row4);
Scan scan = new Scan().withStartRow(row4);
scan.setReversed(true);
scan.setBatch(10);
InternalScanner scanner = region.getScanner(scan);
@ -5756,7 +5756,7 @@ public class TestHRegion {
put2.addColumn(cf1, col, Bytes.toBytes("val"));
region.put(put2);
Scan scan = new Scan(Bytes.toBytes("19998"));
Scan scan = new Scan().withStartRow(Bytes.toBytes("19998"));
scan.setReversed(true);
InternalScanner scanner = region.getScanner(scan);
@ -5804,7 +5804,7 @@ public class TestHRegion {
put2.addColumn(cf1, col, Bytes.toBytes("val"));
region.put(put2);
// create a reverse scan
Scan scan = new Scan(Bytes.toBytes("19996"));
Scan scan = new Scan().withStartRow(Bytes.toBytes("19996"));
scan.setReversed(true);
RegionScannerImpl scanner = region.getScanner(scan);
@ -5858,7 +5858,7 @@ public class TestHRegion {
region.put(put2);
// Create a reverse scan
Scan scan = new Scan(Bytes.toBytes("199996"));
Scan scan = new Scan().withStartRow(Bytes.toBytes("199996"));
scan.setReversed(true);
RegionScannerImpl scanner = region.getScanner(scan);

View File

@ -800,7 +800,7 @@ public class TestKeepDeletes {
d = new Delete(T2, ts+2);
region.delete(d);
Scan s = new Scan(T1);
Scan s = new Scan().withStartRow(T1);
s.setTimeRange(0, ts+1);
InternalScanner scanner = region.getScanner(s);
List<Cell> kvs = new ArrayList<>();
@ -808,7 +808,7 @@ public class TestKeepDeletes {
assertEquals(4, kvs.size());
scanner.close();
s = new Scan(T2);
s = new Scan().withStartRow(T2);
s.setTimeRange(0, ts+2);
scanner = region.getScanner(s);
kvs = new ArrayList<>();

View File

@ -380,7 +380,7 @@ public class TestScanner {
byte [][][] scanColumns = {COLS, EXPLICIT_COLS};
for(int i = 0; i < scanColumns.length; i++) {
try {
scan = new Scan(FIRST_ROW);
scan = new Scan().withStartRow(FIRST_ROW);
for (int ii = 0; ii < EXPLICIT_COLS.length; ii++) {
scan.addColumn(COLS[0], EXPLICIT_COLS[ii]);
}

View File

@ -222,7 +222,7 @@ public class TestTags {
admin.flush(tableName);
Thread.sleep(1000);
Scan s = new Scan(row);
Scan s = new Scan().withStartRow(row);
ResultScanner scanner = table.getScanner(s);
try {
Result[] next = scanner.next(3);
@ -240,7 +240,7 @@ public class TestTags {
while (admin.getCompactionState(tableName) != CompactionState.NONE) {
Thread.sleep(10);
}
s = new Scan(row);
s = new Scan().withStartRow(row);
scanner = table.getScanner(s);
try {
Result[] next = scanner.next(3);
@ -326,7 +326,7 @@ public class TestTags {
Thread.sleep(1000);
TestCoprocessorForTags.checkTagPresence = true;
Scan s = new Scan(row);
Scan s = new Scan().withStartRow(row);
s.setCaching(1);
ResultScanner scanner = table.getScanner(s);
try {
@ -527,7 +527,7 @@ public class TestTags {
private void result(byte[] fam, byte[] row, byte[] qual, byte[] row2, Table table, byte[] value,
byte[] value2, byte[] row1, byte[] value1) throws IOException {
Scan s = new Scan(row);
Scan s = new Scan().withStartRow(row);
// If filters are used this attribute can be specifically check for in
// filterKV method and
// kvs can be filtered out if the tags of interest is not found in that kv

View File

@ -522,7 +522,7 @@ EOF
scan = if stoprow
org.apache.hadoop.hbase.client.Scan.new.with_start_row(startrow.to_java_bytes).with_stop_row(stoprow.to_java_bytes)
else
org.apache.hadoop.hbase.client.Scan.new(startrow.to_java_bytes)
org.apache.hadoop.hbase.client.Scan.new.with_start_row(startrow.to_java_bytes)
end
# This will overwrite any startrow/stoprow settings

View File

@ -935,7 +935,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb
Table table = null;
try {
table = getTable(tableName);
Scan scan = new Scan(getBytes(startRow));
Scan scan = new Scan().withStartRow(getBytes(startRow));
addAttributes(scan, attributes);
if(columns != null && !columns.isEmpty()) {
for(ByteBuffer column : columns) {
@ -996,7 +996,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb
Table table = null;
try {
table = getTable(tableName);
Scan scan = new Scan(getBytes(startAndPrefix));
Scan scan = new Scan().withStartRow(getBytes(startAndPrefix));
addAttributes(scan, attributes);
Filter f = new WhileMatchFilter(
new PrefixFilter(getBytes(startAndPrefix)));
@ -1028,7 +1028,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb
Table table = null;
try {
table = getTable(tableName);
Scan scan = new Scan(getBytes(startRow));
Scan scan = new Scan().withStartRow(getBytes(startRow));
addAttributes(scan, attributes);
scan.setTimeRange(0, timestamp);
if (columns != null && !columns.isEmpty()) {
@ -1158,7 +1158,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb
private Result getReverseScanResult(byte[] tableName, byte[] row, byte[] family)
throws IOException {
Scan scan = new Scan(row);
Scan scan = new Scan().withStartRow(row);
scan.setReversed(true);
scan.addFamily(family);
scan.withStartRow(row);