HBASE-21618 Scan with the same startRow(inclusive=true) and stopRow(inclusive=false) returns one result
This commit is contained in:
parent
a76a842a61
commit
512a6322d9
|
@ -939,9 +939,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()));
|
||||
}
|
||||
|
|
|
@ -1082,9 +1082,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()));
|
||||
}
|
||||
|
|
|
@ -246,6 +246,7 @@ public class TestProtobufUtil {
|
|||
scanBuilder.setCacheBlocks(false);
|
||||
scanBuilder.setCaching(1024);
|
||||
scanBuilder.setTimeRange(ProtobufUtil.toTimeRange(TimeRange.allTime()));
|
||||
scanBuilder.setIncludeStopRow(false);
|
||||
ClientProtos.Scan expectedProto = scanBuilder.build();
|
||||
|
||||
ClientProtos.Scan actualProto = ProtobufUtil.toScan(
|
||||
|
|
|
@ -1090,7 +1090,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)) {
|
||||
|
@ -1113,7 +1113,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<>();
|
||||
|
|
|
@ -22,6 +22,7 @@ import static org.apache.hadoop.hbase.ipc.RpcClient.DEFAULT_CODEC_CLASS;
|
|||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
@ -897,4 +898,41 @@ public class TestScannersFromClientSide {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanWithSameStartRowStopRow() throws IOException {
|
||||
TableName tableName = TableName.valueOf(name.getMethodName());
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,6 +319,7 @@ public class TestProtobufUtil {
|
|||
scanBuilder.setCacheBlocks(false);
|
||||
scanBuilder.setCaching(1024);
|
||||
scanBuilder.setTimeRange(ProtobufUtil.toTimeRange(TimeRange.allTime()));
|
||||
scanBuilder.setIncludeStopRow(false);
|
||||
ClientProtos.Scan expectedProto = scanBuilder.build();
|
||||
|
||||
ClientProtos.Scan actualProto = ProtobufUtil.toScan(
|
||||
|
|
Loading…
Reference in New Issue