@Test public void test() { byte[] lowerInclusiveKey = keyRange.getLowerRange(); if (!keyRange.isLowerInclusive() && !Bytes.equals(lowerInclusiveKey, KeyRange.UNBOUND)) { lowerInclusiveKey = ByteUtil.nextKey(lowerInclusiveKey); } byte[] upperExclusiveKey = keyRange.getUpperRange(); if (keyRange.isUpperInclusive()) { upperExclusiveKey = ByteUtil.nextKey(upperExclusiveKey); } assertEquals(expectedResult, scanRanges.intersectRegion(lowerInclusiveKey,upperExclusiveKey,false)); }
public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; }
ScanRanges { public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; } }
ScanRanges { public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; } private  ScanRanges(RowKeySchema schema, int[] slotSpan, List<List<KeyRange>> ranges, KeyRange scanRange, boolean useSkipScanFilter, boolean isPointLookup, Integer bucketNum, TimeRange rowTimestampRange); }
ScanRanges { public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; } private  ScanRanges(RowKeySchema schema, int[] slotSpan, List<List<KeyRange>> ranges, KeyRange scanRange, boolean useSkipScanFilter, boolean isPointLookup, Integer bucketNum, TimeRange rowTimestampRange); static ScanRanges createPointLookup(List<KeyRange> keys); static ScanRanges createSingleSpan(RowKeySchema schema, List<List<KeyRange>> ranges); static ScanRanges createSingleSpan(RowKeySchema schema, List<List<KeyRange>> ranges, Integer nBuckets, boolean useSkipSan); static ScanRanges create(RowKeySchema schema, List<List<KeyRange>> ranges, int[] slotSpan, Integer nBuckets, boolean useSkipScan, int rowTimestampColIndex); void initializeScan(Scan scan); static byte[] prefixKey(byte[] key, int keyOffset, byte[] prefixKey, int prefixKeyOffset); static byte[] prefixKey(byte[] key, int keyOffset, int keyLength, byte[] prefixKey,
            int prefixKeyOffset); static byte[] stripPrefix(byte[] key, int keyOffset); Scan intersectScan(Scan scan, final byte[] originalStartKey, final byte[] originalStopKey, final int keyOffset, boolean crossesRegionBoundary); boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex); SkipScanFilter getSkipScanFilter(); List<List<KeyRange>> getRanges(); List<List<KeyRange>> getBoundRanges(); RowKeySchema getSchema(); boolean isEverything(); boolean isDegenerate(); boolean useSkipScanFilter(); boolean isPointLookup(); int getPointLookupCount(); Iterator<KeyRange> getPointLookupKeyIterator(); int getBoundPkColumnCount(); int getBoundSlotCount(); @Override String toString(); int[] getSlotSpans(); KeyRange getScanRange(); boolean hasEqualityConstraint(int pkPosition); static TimeRange getDescTimeRange(KeyRange lowestKeyRange, KeyRange highestKeyRange, Field f); TimeRange getRowTimestampRange(); }
ScanRanges { public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; } private  ScanRanges(RowKeySchema schema, int[] slotSpan, List<List<KeyRange>> ranges, KeyRange scanRange, boolean useSkipScanFilter, boolean isPointLookup, Integer bucketNum, TimeRange rowTimestampRange); static ScanRanges createPointLookup(List<KeyRange> keys); static ScanRanges createSingleSpan(RowKeySchema schema, List<List<KeyRange>> ranges); static ScanRanges createSingleSpan(RowKeySchema schema, List<List<KeyRange>> ranges, Integer nBuckets, boolean useSkipSan); static ScanRanges create(RowKeySchema schema, List<List<KeyRange>> ranges, int[] slotSpan, Integer nBuckets, boolean useSkipScan, int rowTimestampColIndex); void initializeScan(Scan scan); static byte[] prefixKey(byte[] key, int keyOffset, byte[] prefixKey, int prefixKeyOffset); static byte[] prefixKey(byte[] key, int keyOffset, int keyLength, byte[] prefixKey,
            int prefixKeyOffset); static byte[] stripPrefix(byte[] key, int keyOffset); Scan intersectScan(Scan scan, final byte[] originalStartKey, final byte[] originalStopKey, final int keyOffset, boolean crossesRegionBoundary); boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex); SkipScanFilter getSkipScanFilter(); List<List<KeyRange>> getRanges(); List<List<KeyRange>> getBoundRanges(); RowKeySchema getSchema(); boolean isEverything(); boolean isDegenerate(); boolean useSkipScanFilter(); boolean isPointLookup(); int getPointLookupCount(); Iterator<KeyRange> getPointLookupKeyIterator(); int getBoundPkColumnCount(); int getBoundSlotCount(); @Override String toString(); int[] getSlotSpans(); KeyRange getScanRange(); boolean hasEqualityConstraint(int pkPosition); static TimeRange getDescTimeRange(KeyRange lowestKeyRange, KeyRange highestKeyRange, Field f); TimeRange getRowTimestampRange(); static final ScanRanges EVERYTHING; static final ScanRanges NOTHING; }