Search in sources :

Example 1 with DeleteDeltaInfo

use of org.apache.carbondata.core.scan.executor.infos.DeleteDeltaInfo in project carbondata by apache.

the class AbstractDetailQueryResultIterator method intialiseInfos.

private void intialiseInfos() {
    for (BlockExecutionInfo blockInfo : blockExecutionInfos) {
        Map<String, DeleteDeltaVo> deletedRowsMap = null;
        DataRefNodeFinder finder = new BTreeDataRefNodeFinder(blockInfo.getEachColumnValueSize(), blockInfo.getDataBlock().getSegmentProperties().getNumberOfSortColumns(), blockInfo.getDataBlock().getSegmentProperties().getNumberOfNoDictSortColumns());
        // if delete delta file is present
        if (null != blockInfo.getDeleteDeltaFilePath() && 0 != blockInfo.getDeleteDeltaFilePath().length) {
            DeleteDeltaInfo deleteDeltaInfo = new DeleteDeltaInfo(blockInfo.getDeleteDeltaFilePath());
            // read and get the delete detail block details
            deletedRowsMap = getDeleteDeltaDetails(blockInfo.getDataBlock(), deleteDeltaInfo);
            // set the deleted row to block execution info
            blockInfo.setDeletedRecordsMap(deletedRowsMap);
        }
        DataRefNode dataRefNode = blockInfo.getDataBlock().getDataRefNode();
        if (dataRefNode instanceof BlockletDataRefNode) {
            BlockletDataRefNode node = (BlockletDataRefNode) dataRefNode;
            blockInfo.setFirstDataBlock(node);
            blockInfo.setNumberOfBlockToScan(node.numberOfNodes());
        } else {
            DataRefNode startDataBlock = finder.findFirstDataBlock(dataRefNode, blockInfo.getStartKey());
            while (startDataBlock.nodeIndex() < blockInfo.getStartBlockletIndex()) {
                startDataBlock = startDataBlock.getNextDataRefNode();
            }
            long numberOfBlockToScan = blockInfo.getNumberOfBlockletToScan();
            // if number of block is less than 0 then take end block.
            if (numberOfBlockToScan <= 0) {
                DataRefNode endDataBlock = finder.findLastDataBlock(dataRefNode, blockInfo.getEndKey());
                numberOfBlockToScan = endDataBlock.nodeIndex() - startDataBlock.nodeIndex() + 1;
            }
            blockInfo.setFirstDataBlock(startDataBlock);
            blockInfo.setNumberOfBlockToScan(numberOfBlockToScan);
        }
    }
}
Also used : BlockletDataRefNode(org.apache.carbondata.core.indexstore.blockletindex.BlockletDataRefNode) DataRefNode(org.apache.carbondata.core.datastore.DataRefNode) DeleteDeltaInfo(org.apache.carbondata.core.scan.executor.infos.DeleteDeltaInfo) BlockExecutionInfo(org.apache.carbondata.core.scan.executor.infos.BlockExecutionInfo) BTreeDataRefNodeFinder(org.apache.carbondata.core.datastore.impl.btree.BTreeDataRefNodeFinder) DataRefNodeFinder(org.apache.carbondata.core.datastore.DataRefNodeFinder) DeleteDeltaVo(org.apache.carbondata.core.mutate.DeleteDeltaVo) BTreeDataRefNodeFinder(org.apache.carbondata.core.datastore.impl.btree.BTreeDataRefNodeFinder) BlockletDataRefNode(org.apache.carbondata.core.indexstore.blockletindex.BlockletDataRefNode)

Aggregations

DataRefNode (org.apache.carbondata.core.datastore.DataRefNode)1 DataRefNodeFinder (org.apache.carbondata.core.datastore.DataRefNodeFinder)1 BTreeDataRefNodeFinder (org.apache.carbondata.core.datastore.impl.btree.BTreeDataRefNodeFinder)1 BlockletDataRefNode (org.apache.carbondata.core.indexstore.blockletindex.BlockletDataRefNode)1 DeleteDeltaVo (org.apache.carbondata.core.mutate.DeleteDeltaVo)1 BlockExecutionInfo (org.apache.carbondata.core.scan.executor.infos.BlockExecutionInfo)1 DeleteDeltaInfo (org.apache.carbondata.core.scan.executor.infos.DeleteDeltaInfo)1