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());
}
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);
}
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();
}
}
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();
}
Aggregations