HBASE-14928 Start row should be set for query through HBase REST gateway involving globbing option
This commit is contained in:
parent
03e4712f0c
commit
d18c1af3bb
@ -137,20 +137,26 @@ public class TableResource extends ResourceBase {
|
|||||||
@DefaultValue("") @QueryParam(Constants.SCAN_FILTER) String filters) {
|
@DefaultValue("") @QueryParam(Constants.SCAN_FILTER) String filters) {
|
||||||
try {
|
try {
|
||||||
Filter filter = null;
|
Filter filter = null;
|
||||||
|
Scan tableScan = new Scan();
|
||||||
if (scanSpec.indexOf('*') > 0) {
|
if (scanSpec.indexOf('*') > 0) {
|
||||||
String prefix = scanSpec.substring(0, scanSpec.indexOf('*'));
|
String prefix = scanSpec.substring(0, scanSpec.indexOf('*'));
|
||||||
|
byte[] prefixBytes = Bytes.toBytes(prefix);
|
||||||
filter = new PrefixFilter(Bytes.toBytes(prefix));
|
filter = new PrefixFilter(Bytes.toBytes(prefix));
|
||||||
|
if (startRow.isEmpty()) {
|
||||||
|
tableScan.setStartRow(prefixBytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LOG.debug("Query parameters : Table Name = > " + this.table + " Start Row => " + startRow
|
LOG.debug("Query parameters : Table Name = > " + this.table + " Start Row => " + startRow
|
||||||
+ " End Row => " + endRow + " Columns => " + column + " Start Time => " + startTime
|
+ " End Row => " + endRow + " Columns => " + column + " Start Time => " + startTime
|
||||||
+ " End Time => " + endTime + " Cache Blocks => " + cacheBlocks + " Max Versions => "
|
+ " End Time => " + endTime + " Cache Blocks => " + cacheBlocks + " Max Versions => "
|
||||||
+ maxVersions + " Batch Size => " + batchSize);
|
+ maxVersions + " Batch Size => " + batchSize);
|
||||||
Table hTable = RESTServlet.getInstance().getTable(this.table);
|
Table hTable = RESTServlet.getInstance().getTable(this.table);
|
||||||
Scan tableScan = new Scan();
|
|
||||||
tableScan.setBatch(batchSize);
|
tableScan.setBatch(batchSize);
|
||||||
tableScan.setMaxVersions(maxVersions);
|
tableScan.setMaxVersions(maxVersions);
|
||||||
tableScan.setTimeRange(startTime, endTime);
|
tableScan.setTimeRange(startTime, endTime);
|
||||||
|
if (!startRow.isEmpty()) {
|
||||||
tableScan.setStartRow(Bytes.toBytes(startRow));
|
tableScan.setStartRow(Bytes.toBytes(startRow));
|
||||||
|
}
|
||||||
tableScan.setStopRow(Bytes.toBytes(endRow));
|
tableScan.setStopRow(Bytes.toBytes(endRow));
|
||||||
for (String csplit : column) {
|
for (String csplit : column) {
|
||||||
String[] familysplit = csplit.trim().split(":");
|
String[] familysplit = csplit.trim().split(":");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user