use of org.apache.carbondata.core.datastore.BTreeBuilderInfo 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.BTreeBuilderInfo in project carbondata by apache.
the class BlockIndexTest method testBuild.
@Test
public void testBuild() {
segmentInfo = new SegmentInfo();
new MockUp<BlockletBTreeBuilder>() {
@Mock
public void build(BTreeBuilderInfo segmentBuilderInfos) {
}
};
int expectedValue = 0;
BlockIndex blockIndex = new BlockIndex();
columnSchema.setColumnName("employeeName");
columnSchemaList.add(new ColumnSchema());
footer.setSegmentInfo(segmentInfo);
footer.setColumnInTable(columnSchemaList);
footer.setBlockletList(Arrays.asList(blockletInfo));
footerList.add(footer);
blockIndex.buildIndex(footerList);
assertEquals(footerList.get(0).getNumberOfRows(), expectedValue);
}
use of org.apache.carbondata.core.datastore.BTreeBuilderInfo 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.BTreeBuilderInfo 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();
}
use of org.apache.carbondata.core.datastore.BTreeBuilderInfo in project carbondata by apache.
the class SegmentTaskIndexTest method testBuild.
@Test
public void testBuild() {
new MockUp<BlockBTreeBuilder>() {
@Mock
public void build(BTreeBuilderInfo segmentBuilderInfos) {
}
};
long numberOfRows = 100;
columnSchema.setColumnName("employeeName");
columnSchemaList.add(new ColumnSchema());
footer.setSegmentInfo(segmentInfo);
footer.setColumnInTable(columnSchemaList);
footer.setBlockletList(Arrays.asList(blockletInfo));
footer.setNumberOfRows(numberOfRows);
footerList.add(footer);
SegmentProperties properties = new SegmentProperties(footerList.get(0).getColumnInTable(), footerList.get(0).getSegmentInfo().getColumnCardinality());
SegmentTaskIndex segmentTaskIndex = new SegmentTaskIndex(properties);
segmentTaskIndex.buildIndex(footerList);
assertEquals(footerList.get(0).getNumberOfRows(), numberOfRows);
}
Aggregations