HBASE-13892 NPE in ClientScanner on null results array
Signed-off-by: Andrew Purtell <apurtell@apache.org> Amending-Author: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
9d3422ed16
commit
8cef99e506
|
@ -586,7 +586,8 @@ public abstract class ClientScanner extends AbstractClientScanner {
|
|||
// the caller will receive a result back where the number of cells in the result is less than
|
||||
// the batch size even though it may not be the last group of cells for that row.
|
||||
if (allowPartials || isBatchSet) {
|
||||
addResultsToList(resultsToAddToCache, resultsFromServer, 0, resultsFromServer.length);
|
||||
addResultsToList(resultsToAddToCache, resultsFromServer, 0,
|
||||
(null == resultsFromServer ? 0 : resultsFromServer.length));
|
||||
return resultsToAddToCache;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ import org.apache.hadoop.hbase.filter.CompareFilter;
|
|||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||
import org.apache.hadoop.hbase.filter.Filter;
|
||||
import org.apache.hadoop.hbase.filter.FilterList;
|
||||
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
|
||||
import org.apache.hadoop.hbase.filter.InclusiveStopFilter;
|
||||
import org.apache.hadoop.hbase.filter.KeyOnlyFilter;
|
||||
import org.apache.hadoop.hbase.filter.LongComparator;
|
||||
import org.apache.hadoop.hbase.filter.PrefixFilter;
|
||||
|
@ -6320,4 +6322,18 @@ public class TestFromClientSide {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterAllRecords() throws IOException {
|
||||
Scan scan = new Scan();
|
||||
scan.setBatch(1);
|
||||
scan.setCaching(1);
|
||||
// Filter out any records
|
||||
scan.setFilter(new FilterList(new FirstKeyOnlyFilter(), new InclusiveStopFilter(new byte[0])));
|
||||
try (Table table = TEST_UTIL.getConnection().getTable(TableName.NAMESPACE_TABLE_NAME)) {
|
||||
try (ResultScanner s = table.getScanner(scan)) {
|
||||
assertNull(s.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue