HBASE-13892 NPE in ClientScanner on null results array
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
abf1aa603c
commit
e78572a985
|
@ -573,7 +573,8 @@ public 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,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;
|
||||
|
@ -6415,4 +6417,17 @@ 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])));
|
||||
Table table = TEST_UTIL.getConnection().getTable(TableName.NAMESPACE_TABLE_NAME);
|
||||
ResultScanner s = table.getScanner(scan);
|
||||
assertNull(s.next());
|
||||
table.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue