HBASE-21618 Scan with the same startRow(inclusive=true) and stopRow(inclusive=false) returns one result
This commit is contained in:
parent
bbf17e6149
commit
98640e4b2c
|
@ -1086,9 +1086,7 @@ public final class ProtobufUtil {
|
|||
if (!scan.includeStartRow()) {
|
||||
scanBuilder.setIncludeStartRow(false);
|
||||
}
|
||||
if (scan.includeStopRow()) {
|
||||
scanBuilder.setIncludeStopRow(true);
|
||||
}
|
||||
scanBuilder.setIncludeStopRow(scan.includeStopRow());
|
||||
if (scan.getReadType() != Scan.ReadType.DEFAULT) {
|
||||
scanBuilder.setReadType(toReadType(scan.getReadType()));
|
||||
}
|
||||
|
|
|
@ -839,7 +839,7 @@ public class TestFromClientSide3 {
|
|||
}
|
||||
|
||||
Scan scan = new Scan();
|
||||
scan.withStartRow(ROW).withStopRow(ROW).addFamily(FAMILY).setBatch(3)
|
||||
scan.withStartRow(ROW).withStopRow(ROW, true).addFamily(FAMILY).setBatch(3)
|
||||
.setMaxResultSize(4 * 1024 * 1024);
|
||||
Result result;
|
||||
try (ResultScanner scanner = table.getScanner(scan)) {
|
||||
|
@ -861,7 +861,7 @@ public class TestFromClientSide3 {
|
|||
}
|
||||
|
||||
scan = new Scan();
|
||||
scan.withStartRow(ROW).withStopRow(ROW).addFamily(FAMILY).setBatch(2)
|
||||
scan.withStartRow(ROW).withStopRow(ROW, true).addFamily(FAMILY).setBatch(2)
|
||||
.setMaxResultSize(4 * 1024 * 1024);
|
||||
try (ResultScanner scanner = table.getScanner(scan)) {
|
||||
List<Result> list = new ArrayList<>();
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.hadoop.hbase.client;
|
|||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
@ -699,4 +700,41 @@ public class TestScannersFromClientSide {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanWithSameStartRowStopRow() throws IOException {
|
||||
TableName tableName = TableName.valueOf("testScanWithSameStartRowStopRow");
|
||||
try (Table table = TEST_UTIL.createTable(tableName, FAMILY)) {
|
||||
table.put(new Put(ROW).addColumn(FAMILY, QUALIFIER, VALUE));
|
||||
|
||||
Scan scan = new Scan().withStartRow(ROW).withStopRow(ROW);
|
||||
try (ResultScanner scanner = table.getScanner(scan)) {
|
||||
assertNull(scanner.next());
|
||||
}
|
||||
|
||||
scan = new Scan().withStartRow(ROW, true).withStopRow(ROW, true);
|
||||
try (ResultScanner scanner = table.getScanner(scan)) {
|
||||
Result result = scanner.next();
|
||||
assertNotNull(result);
|
||||
assertArrayEquals(ROW, result.getRow());
|
||||
assertArrayEquals(VALUE, result.getValue(FAMILY, QUALIFIER));
|
||||
assertNull(scanner.next());
|
||||
}
|
||||
|
||||
scan = new Scan().withStartRow(ROW, true).withStopRow(ROW, false);
|
||||
try (ResultScanner scanner = table.getScanner(scan)) {
|
||||
assertNull(scanner.next());
|
||||
}
|
||||
|
||||
scan = new Scan().withStartRow(ROW, false).withStopRow(ROW, false);
|
||||
try (ResultScanner scanner = table.getScanner(scan)) {
|
||||
assertNull(scanner.next());
|
||||
}
|
||||
|
||||
scan = new Scan().withStartRow(ROW, false).withStopRow(ROW, true);
|
||||
try (ResultScanner scanner = table.getScanner(scan)) {
|
||||
assertNull(scanner.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -302,6 +302,7 @@ public class TestProtobufUtil {
|
|||
scanBuilder.setMaxVersions(2);
|
||||
scanBuilder.setCacheBlocks(false);
|
||||
scanBuilder.setCaching(1024);
|
||||
scanBuilder.setIncludeStopRow(false);
|
||||
ClientProtos.Scan expectedProto = scanBuilder.build();
|
||||
|
||||
ClientProtos.Scan actualProto = ProtobufUtil.toScan(
|
||||
|
|
Loading…
Reference in New Issue