NonLeafFilterNode nlfNode = (NonLeafFilterNode) node;
Map<List<FilterColumnValueDetail>, IndexSpecification> indicesToUse = nlfNode.getIndexToUse();
for (Entry<List<FilterColumnValueDetail>, IndexSpecification> entry : indicesToUse.entrySet()) {
List<FilterColumnValueDetail> fcvdList = entry.getKey();
byte[] indexName = Bytes.toBytes(entry.getValue().getName());
ByteArrayBuilder indexNameBuilder =
ByteArrayBuilder.allocate(IndexUtils.getMaxIndexNameLength());
indexNameBuilder.put(indexName);
Scan scan = createScan(regionStartKey, indexName, fcvdList, startRow, stopRow);
boolean isRange = isHavingRangeFilters(fcvdList);
if (!hasRangeScanner && isRange) hasRangeScanner = isRange;
createRegionScanner(indexRegion, userTableName, scanners, indexNameBuilder, scan, isRange,
++scannerIndex);
}
for (FilterNode fn : nlfNode.getFilterNodes()) {
IndexRegionScanner childIndexScaner =
createIndexScannerScheme(fn, regionStartKey, startRow, stopRow, indexRegion,
userTableName);
childIndexScaner.setScannerIndex(++scannerIndex);
scanners.add(childIndexScaner);
if (!hasRangeScanner) hasRangeScanner = childIndexScaner.isRange();
}
idxScanner = createScannerForNonLeafNode(scanners, nlfNode.getGroupingCondition());
idxScanner.setRangeFlag(hasRangeScanner);
return idxScanner;
} else if (node instanceof PossibleIndexFilterNode) {
LOG.info("No index can be used for the column "
+ ((PossibleIndexFilterNode) node).getFilterColumnValueDetail().getColumn());
return null;
} else if (node instanceof IndexFilterNode) {
// node is IndexFilterNode
IndexFilterNode ifNode = (IndexFilterNode) node;
// There will be only one entry in this Map
List<FilterColumnValueDetail> filterColsDetails =
ifNode.getIndexToUse().keySet().iterator().next();
byte[] indexName = Bytes.toBytes(ifNode.getBestIndex().getName());
ByteArrayBuilder indexNameBuilder =
ByteArrayBuilder.allocate(IndexUtils.getMaxIndexNameLength());
indexNameBuilder.put(indexName);
Scan scan = createScan(regionStartKey, indexName, filterColsDetails, startRow, stopRow);
boolean isRange = isHavingRangeFilters(filterColsDetails);
createRegionScanner(indexRegion, userTableName, scanners, indexNameBuilder, scan, isRange,
++scannerIndex);
idxScanner = createScannerForNonLeafNode(scanners, null);