use of org.apache.carbondata.core.indexstore.Blocklet in project carbondata by apache.
the class MinMaxIndex method prune.
/**
* Block Prunning logic for Min Max Index.
*
* @param filterExp
* @param segmentProperties
* @return
*/
@Override
public List<Blocklet> prune(FilterResolverIntf filterExp, SegmentProperties segmentProperties, List<PartitionSpec> partitions) {
List<Blocklet> blocklets = new ArrayList<>();
if (filterExp == null) {
for (int i = 0; i < readMinMaxIndex.length; i++) {
for (int j = 0; j < readMinMaxIndex[i].length; j++) {
blocklets.add(new Blocklet(indexFilePath[i], String.valueOf(readMinMaxIndex[i][j].getBlockletId())));
}
}
} else {
FilterExecuter filterExecuter = FilterUtil.getFilterExecuterTree(filterExp, segmentProperties, null, false);
for (int blkIdx = 0; blkIdx < readMinMaxIndex.length; blkIdx++) {
for (int blkltIdx = 0; blkltIdx < readMinMaxIndex[blkIdx].length; blkltIdx++) {
BitSet bitSet = filterExecuter.isScanRequired(readMinMaxIndex[blkIdx][blkltIdx].getMaxValues(), readMinMaxIndex[blkIdx][blkltIdx].getMinValues(), null);
if (!bitSet.isEmpty()) {
String blockFileName = indexFilePath[blkIdx].substring(indexFilePath[blkIdx].lastIndexOf(File.separatorChar) + 1, indexFilePath[blkIdx].indexOf(".minmaxindex"));
Blocklet blocklet = new Blocklet(blockFileName, String.valueOf(readMinMaxIndex[blkIdx][blkltIdx].getBlockletId()));
LOGGER.info(String.format("Need to scan block#%s -> blocklet#%s, %s", blkIdx, blkltIdx, blocklet));
blocklets.add(blocklet);
} else {
LOGGER.info(String.format("Skip scan block#%s -> blocklet#%s", blkIdx, blkltIdx));
}
}
}
}
return blocklets;
}
Aggregations