for (int i = 0; i < indexRanges.size() - 1; ++i) {
FilteredIndexRange<Object, BigIntegerRange> a = indexRanges.get(i);
FilteredIndexRange<Object, BigIntegerRange> b = indexRanges.get(i + 1);
Assert.assertTrue(a.getIndexRange().getEnd().compareTo(b.getIndexRange().getStart()) < 0);
}
BitVector start = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
BitVector end = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
Scan[] scans = new Scan[indexRanges.size()];
for (int i = 0; i < indexRanges.size(); ++i) {
FilteredIndexRange<Object, BigIntegerRange> indexRange = indexRanges.get(i);
BigInteger startBigInteger = indexRange.getIndexRange().getStart();
start.copyFrom(startBigInteger);
BigInteger endBigInteger = indexRange.getIndexRange().getEnd();
final Scan scan;
if (endBigInteger.testBit(spec.sumBitsPerDimension())) {
scan = new Scan(start.toBigEndianByteArray());
} else {
end.copyFrom(endBigInteger);
scan = new Scan(start.toBigEndianByteArray(), end.toBigEndianByteArray());
}
scans[i] = scan;
}
BitVector[] point = new BitVector[spec.getBitsPerDimension().size()];
BitVector index = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
for (int j = 0; j < spec.getBitsPerDimension().size(); ++j) {
point[j] = BitVectorFactories.OPTIMAL.apply(spec.getBitsPerDimension().get(j));
}
List<int[]> actual = new ArrayList<>();
for (int i = 0; i < indexRanges.size(); ++i) {
ResultScanner scanner = table.getScanner(scans[i]);
FilteredIndexRange<Object, BigIntegerRange> indexRange = indexRanges.get(i);
logger.log(Level.FINE, "indexRange={0}", indexRange);
for (Result result : scanner) {
byte[] row = result.getRow();
index.copyFromBigEndian(row);
sfc.indexInverse(index, point);
boolean isContained = RangeUtil.containsBigInteger(
region, Arrays.asList(bitVectorPointToBigIntegerPoint(point)));
if (!indexRange.isPotentialOverSelectivity()) {
Assert.assertTrue(isContained);