Search in sources :

Example 16 with DataRefNode

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;
}
Also used : IndexKey(org.apache.carbondata.core.datastore.IndexKey) KeyGenException(org.apache.carbondata.core.keygenerator.KeyGenException) DataRefNode(org.apache.carbondata.core.datastore.DataRefNode) SegmentProperties(org.apache.carbondata.core.datastore.block.SegmentProperties) BTreeDataRefNodeFinder(org.apache.carbondata.core.datastore.impl.btree.BTreeDataRefNodeFinder) DataRefNodeFinder(org.apache.carbondata.core.datastore.DataRefNodeFinder) LinkedList(java.util.LinkedList) BTreeDataRefNodeFinder(org.apache.carbondata.core.datastore.impl.btree.BTreeDataRefNodeFinder)

Aggregations

DataRefNode (org.apache.carbondata.core.datastore.DataRefNode)16 DataRefNodeFinder (org.apache.carbondata.core.datastore.DataRefNodeFinder)10 IndexKey (org.apache.carbondata.core.datastore.IndexKey)9 BTreeBuilderInfo (org.apache.carbondata.core.datastore.BTreeBuilderInfo)6 BtreeBuilder (org.apache.carbondata.core.datastore.BtreeBuilder)6 DataFileFooter (org.apache.carbondata.core.metadata.blocklet.DataFileFooter)6 Test (org.junit.Test)6 BTreeDataRefNodeFinder (org.apache.carbondata.core.datastore.impl.btree.BTreeDataRefNodeFinder)5 LinkedList (java.util.LinkedList)3 KeyGenException (org.apache.carbondata.core.keygenerator.KeyGenException)3 KeyGenerator (org.apache.carbondata.core.keygenerator.KeyGenerator)3 MultiDimKeyVarLengthGenerator (org.apache.carbondata.core.keygenerator.mdkey.MultiDimKeyVarLengthGenerator)3 ByteBuffer (java.nio.ByteBuffer)2 AbstractIndex (org.apache.carbondata.core.datastore.block.AbstractIndex)2 SegmentProperties (org.apache.carbondata.core.datastore.block.SegmentProperties)2 TableBlockInfo (org.apache.carbondata.core.datastore.block.TableBlockInfo)2 BlockBTreeLeafNode (org.apache.carbondata.core.datastore.impl.btree.BlockBTreeLeafNode)2 AbsoluteTableIdentifier (org.apache.carbondata.core.metadata.AbsoluteTableIdentifier)2 FilterExpressionProcessor (org.apache.carbondata.core.scan.filter.FilterExpressionProcessor)2 QueryStatistic (org.apache.carbondata.core.stats.QueryStatistic)2