Search in sources :

Example 6 with BtreeBuilder

use of org.apache.carbondata.core.datastore.BtreeBuilder in project carbondata by apache.

the class BTreeBlockFinderTest method testBtreeSearchIsWorkingAndGivingPorperBlockletWithNoDictionary1.

@Test
public void testBtreeSearchIsWorkingAndGivingPorperBlockletWithNoDictionary1() {
    BtreeBuilder builder = new BlockBTreeBuilder();
    List<DataFileFooter> footerList = getFileFooterListWithOnlyNoDictionaryKey();
    BTreeBuilderInfo infos = new BTreeBuilderInfo(footerList, null);
    builder.build(infos);
    DataRefNode dataBlock = builder.get();
    assertTrue(dataBlock != null);
    DataRefNodeFinder finder = new BTreeDataRefNodeFinder(new int[] { -1 }, 1, 1);
    ByteBuffer buffer = ByteBuffer.allocate(4 + 2);
    buffer.rewind();
    buffer.putShort((short) 1);
    buffer.putInt(12);
    buffer.array();
    IndexKey key = new IndexKey(null, buffer.array());
    DataRefNode findFirstBlock = finder.findFirstDataBlock(dataBlock, key);
    assertEquals(1, findFirstBlock.nodeNumber());
    DataRefNode findLastBlock = finder.findLastDataBlock(dataBlock, key);
    assertEquals(1, findLastBlock.nodeNumber());
}
Also used : IndexKey(org.apache.carbondata.core.datastore.IndexKey) DataFileFooter(org.apache.carbondata.core.metadata.blocklet.DataFileFooter) BTreeBuilderInfo(org.apache.carbondata.core.datastore.BTreeBuilderInfo) DataRefNode(org.apache.carbondata.core.datastore.DataRefNode) DataRefNodeFinder(org.apache.carbondata.core.datastore.DataRefNodeFinder) ByteBuffer(java.nio.ByteBuffer) BtreeBuilder(org.apache.carbondata.core.datastore.BtreeBuilder) Test(org.junit.Test)

Example 7 with BtreeBuilder

use of org.apache.carbondata.core.datastore.BtreeBuilder in project carbondata by apache.

the class BTreeBlockFinderTest method testBtreeBuldingIsPorper.

@Test
public void testBtreeBuldingIsPorper() {
    BtreeBuilder builder = new BlockBTreeBuilder();
    List<DataFileFooter> footerList = getDataFileFooterList();
    BTreeBuilderInfo infos = new BTreeBuilderInfo(footerList, null);
    builder.build(infos);
}
Also used : DataFileFooter(org.apache.carbondata.core.metadata.blocklet.DataFileFooter) BTreeBuilderInfo(org.apache.carbondata.core.datastore.BTreeBuilderInfo) BtreeBuilder(org.apache.carbondata.core.datastore.BtreeBuilder) Test(org.junit.Test)

Example 8 with BtreeBuilder

use of org.apache.carbondata.core.datastore.BtreeBuilder in project carbondata by apache.

the class SegmentTaskIndex method buildIndex.

/**
   * Below method is store the blocks in some data structure
   *
   */
public void buildIndex(List<DataFileFooter> footerList) {
    // create a segment builder info
    // in case of segment create we do not need any file path and each column value size
    // as Btree will be build as per min max and start key
    BTreeBuilderInfo btreeBuilderInfo = new BTreeBuilderInfo(footerList, null);
    BtreeBuilder blocksBuilder = new BlockBTreeBuilder();
    // load the metadata
    blocksBuilder.build(btreeBuilderInfo);
    dataRefNode = blocksBuilder.get();
    for (DataFileFooter footer : footerList) {
        totalNumberOfRows += footer.getNumberOfRows();
    }
}
Also used : DataFileFooter(org.apache.carbondata.core.metadata.blocklet.DataFileFooter) BTreeBuilderInfo(org.apache.carbondata.core.datastore.BTreeBuilderInfo) BlockBTreeBuilder(org.apache.carbondata.core.datastore.impl.btree.BlockBTreeBuilder) BtreeBuilder(org.apache.carbondata.core.datastore.BtreeBuilder)

Example 9 with BtreeBuilder

use of org.apache.carbondata.core.datastore.BtreeBuilder in project carbondata by apache.

the class BlockIndex method buildIndex.

/**
   * Below method will be used to load the data block
   *
   */
public void buildIndex(List<DataFileFooter> footerList) {
    // create a metadata details
    // this will be useful in query handling
    segmentProperties = new SegmentProperties(footerList.get(0).getColumnInTable(), footerList.get(0).getSegmentInfo().getColumnCardinality());
    // create a segment builder info
    BTreeBuilderInfo indexBuilderInfo = new BTreeBuilderInfo(footerList, segmentProperties.getDimensionColumnsValueSize());
    BtreeBuilder blocksBuilder = new BlockletBTreeBuilder();
    // load the metadata
    blocksBuilder.build(indexBuilderInfo);
    dataRefNode = blocksBuilder.get();
    totalNumberOfRows = footerList.get(0).getNumberOfRows();
}
Also used : BTreeBuilderInfo(org.apache.carbondata.core.datastore.BTreeBuilderInfo) BlockletBTreeBuilder(org.apache.carbondata.core.datastore.impl.btree.BlockletBTreeBuilder) BtreeBuilder(org.apache.carbondata.core.datastore.BtreeBuilder)

Aggregations

BTreeBuilderInfo (org.apache.carbondata.core.datastore.BTreeBuilderInfo)9 BtreeBuilder (org.apache.carbondata.core.datastore.BtreeBuilder)9 DataFileFooter (org.apache.carbondata.core.metadata.blocklet.DataFileFooter)8 Test (org.junit.Test)7 DataRefNode (org.apache.carbondata.core.datastore.DataRefNode)6 DataRefNodeFinder (org.apache.carbondata.core.datastore.DataRefNodeFinder)5 IndexKey (org.apache.carbondata.core.datastore.IndexKey)5 KeyGenerator (org.apache.carbondata.core.keygenerator.KeyGenerator)3 MultiDimKeyVarLengthGenerator (org.apache.carbondata.core.keygenerator.mdkey.MultiDimKeyVarLengthGenerator)3 ByteBuffer (java.nio.ByteBuffer)2 BlockBTreeBuilder (org.apache.carbondata.core.datastore.impl.btree.BlockBTreeBuilder)1 BlockletBTreeBuilder (org.apache.carbondata.core.datastore.impl.btree.BlockletBTreeBuilder)1