use of org.apache.carbondata.core.datastore.DataRefNode in project carbondata by apache.
the class InMemoryBTreeIndex method getDataBlocksOfIndex.
/**
* get data blocks of given btree
*/
private List<DataRefNode> getDataBlocksOfIndex(AbstractIndex abstractIndex) {
List<DataRefNode> blocks = new LinkedList<DataRefNode>();
SegmentProperties segmentProperties = abstractIndex.getSegmentProperties();
try {
IndexKey startIndexKey = FilterUtil.prepareDefaultStartIndexKey(segmentProperties);
IndexKey endIndexKey = FilterUtil.prepareDefaultEndIndexKey(segmentProperties);
// Add all blocks of btree into result
DataRefNodeFinder blockFinder = new BTreeDataRefNodeFinder(segmentProperties.getEachDimColumnValueSize(), segmentProperties.getNumberOfSortColumns(), segmentProperties.getNumberOfNoDictSortColumns());
DataRefNode startBlock = blockFinder.findFirstDataBlock(abstractIndex.getDataRefNode(), startIndexKey);
DataRefNode endBlock = blockFinder.findLastDataBlock(abstractIndex.getDataRefNode(), endIndexKey);
while (startBlock != endBlock) {
blocks.add(startBlock);
startBlock = startBlock.getNextDataRefNode();
}
blocks.add(endBlock);
} catch (KeyGenException e) {
LOG.error("Could not generate start key", e);
}
return blocks;
}
Aggregations