/** * convert BlockletMinMaxIndex of carbon metadata to external thrift BlockletMinMaxIndex */ public static BlockletMinMaxIndex convertMinMaxIndex( org.apache.carbondata.core.metadata.blocklet.index.BlockletMinMaxIndex minMaxIndex) { if (minMaxIndex == null) { return null; } BlockletMinMaxIndex blockletMinMaxIndex = new BlockletMinMaxIndex(); for (int i = 0; i < minMaxIndex.getMaxValues().length; i++) { blockletMinMaxIndex.addToMax_values(ByteBuffer.wrap(minMaxIndex.getMaxValues()[i])); blockletMinMaxIndex.addToMin_values(ByteBuffer.wrap(minMaxIndex.getMinValues()[i])); blockletMinMaxIndex.addToMin_max_presence(minMaxIndex.getIsMinMaxSet()[i]); } return blockletMinMaxIndex; }
private BlockletMinMaxIndex buildMinMaxIndex(ColumnPage inputPage, List<Encoding> encoders) { BlockletMinMaxIndex index = new BlockletMinMaxIndex(); ByteBuffer max; ByteBuffer min; if (CarbonUtil.isEncodedWithMeta(encoders) && inputPage.getColumnSpec().getColumnType() == ColumnType.PLAIN_VALUE) { max = ByteBuffer.wrap(DataTypeUtil .getMinMaxBytesBasedOnDataTypeForNoDictionaryColumn(inputPage.getStatistics().getMax(), inputPage.getDataType())); min = ByteBuffer.wrap(DataTypeUtil .getMinMaxBytesBasedOnDataTypeForNoDictionaryColumn(inputPage.getStatistics().getMin(), inputPage.getDataType())); } else { byte[] bytes = CarbonUtil.getValueAsBytes(inputPage.getDataType(), inputPage.getStatistics().getMax()); max = ByteBuffer.wrap(bytes); min = ByteBuffer.wrap( CarbonUtil.getValueAsBytes(inputPage.getDataType(), inputPage.getStatistics().getMin())); } index.addToMax_values(max); index.addToMin_values(min); index.addToMin_max_presence(inputPage.getStatistics().writeMinMax()); return index; }
blockletMinMaxIndex.addToMin_values(ByteBuffer.wrap(min)); blockletMinMaxIndex.addToMin_values(ByteBuffer.wrap(min));