public Object getFieldValue(_Fields field) { switch (field) { case MIN_MAX_INDEX: return getMin_max_index(); case B_TREE_INDEX: return getB_tree_index(); } throw new IllegalStateException(); }
index.b_tree_index.getEnd_key()); BlockletMinMaxIndex minMaxIndex = new BlockletMinMaxIndex(index.getMin_max_index().getMin_values(), index.getMin_max_index().getMax_values(), index.getMin_max_index().getMin_max_presence()); org.apache.carbondata.core.metadata.blocklet.index.BlockletIndex bIndex = new org.apache.carbondata.core.metadata.blocklet.index.BlockletIndex(bTreeIndex,
private boolean isScanRequired(BlockletHeader header) { if (filter != null && header.getBlocklet_index() != null) { BlockletMinMaxIndex minMaxIndex = CarbonMetadataUtil.convertExternalMinMaxIndex( header.getBlocklet_index().getMin_max_index()); if (minMaxIndex != null) { BitSet bitSet = filter .isScanRequired(minMaxIndex.getMaxValues(), minMaxIndex.getMinValues(), minMaxIndex.getIsMinMaxSet()); if (bitSet.isEmpty()) { return false; } else { return true; } } } return true; }
/** * Below method will be used to convert the blocklet index of thrift to * wrapper * * @param blockletIndexThrift * @return blocklet index wrapper */ protected BlockletIndex getBlockletIndex( org.apache.carbondata.format.BlockletIndex blockletIndexThrift) { org.apache.carbondata.format.BlockletBTreeIndex btreeIndex = blockletIndexThrift.getB_tree_index(); org.apache.carbondata.format.BlockletMinMaxIndex minMaxIndex = blockletIndexThrift.getMin_max_index(); List<Boolean> isMinMaxSet = null; // Below logic is added to handle backward compatibility if (minMaxIndex.isSetMin_max_presence()) { isMinMaxSet = minMaxIndex.getMin_max_presence(); } else { Boolean[] minMaxFlag = new Boolean[minMaxIndex.getMax_values().size()]; Arrays.fill(minMaxFlag, true); isMinMaxSet = Arrays.asList(minMaxFlag); } return new BlockletIndex( new BlockletBTreeIndex(btreeIndex.getStart_key(), btreeIndex.getEnd_key()), new BlockletMinMaxIndex(minMaxIndex.getMin_values(), minMaxIndex.getMax_values(), isMinMaxSet)); }
/** * merge new blocklet index and old file index to create new file index */ private static void updateStreamFileIndex(Map<String, StreamFileIndex> indexMap, String indexPath, FileFactory.FileType fileType, DataType[] msrDataTypes ) throws IOException { List<BlockIndex> blockIndexList = readIndexFile(indexPath, fileType); for (BlockIndex blockIndex : blockIndexList) { BlockletMinMaxIndex fileIndex = CarbonMetadataUtil .convertExternalMinMaxIndex(blockIndex.getBlock_index().getMin_max_index()); StreamFileIndex blockletIndex = indexMap.get(blockIndex.getFile_name()); if (blockletIndex == null) { // should index all stream file indexMap.put(blockIndex.getFile_name(), new StreamFileIndex(blockIndex.getFile_name(), fileIndex, blockIndex.getNum_rows())); } else { // merge minMaxIndex into StreamBlockIndex blockletIndex.setRowCount(blockletIndex.getRowCount() + blockIndex.getNum_rows()); mergeBatchMinMax(blockletIndex, fileIndex, msrDataTypes); } } }
if (withMinMax) { if (blockIndex.getBlock_index() != null && blockIndex.getBlock_index().getMin_max_index() != null) { streamFile.setMinMaxIndex(CarbonMetadataUtil .convertExternalMinMaxIndex(blockIndex.getBlock_index().getMin_max_index()));