List of usage examples for org.apache.commons.lang3 ArrayUtils toPrimitive
public static boolean[] toPrimitive(final Boolean[] array)
Converts an array of object Booleans to primitives.
This method returns null for a null input array.
From source file:org.apache.carbondata.core.metadata.blocklet.index.BlockletMinMaxIndex.java
public BlockletMinMaxIndex(List<ByteBuffer> minValues, List<ByteBuffer> maxValues, List<Boolean> isMinMaxSet) { this.minValues = new byte[minValues.size()][]; this.maxValues = new byte[maxValues.size()][]; for (int i = 0; i < minValues.size(); i++) { this.minValues[i] = minValues.get(i).array(); this.maxValues[i] = maxValues.get(i).array(); }/*from w w w.ja v a 2 s . com*/ this.isMinMaxSet = ArrayUtils.toPrimitive(isMinMaxSet.toArray(new Boolean[isMinMaxSet.size()])); }
From source file:org.apache.carbondata.core.scan.collector.impl.DictionaryBasedResultCollector.java
protected void initDimensionAndMeasureIndexesForFillingData() { List<Integer> dictionaryIndexes = new ArrayList<Integer>(); for (int i = 0; i < queryDimensions.length; i++) { if (queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY) || queryDimensions[i].getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) { dictionaryIndexes.add(queryDimensions[i].getDimension().getOrdinal()); }//from w w w . ja v a 2 s .c o m } int[] primitive = ArrayUtils.toPrimitive(dictionaryIndexes.toArray(new Integer[dictionaryIndexes.size()])); Arrays.sort(primitive); actualIndexInSurrogateKey = new int[dictionaryIndexes.size()]; int index = 0; for (int i = 0; i < queryDimensions.length; i++) { if (queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY) || queryDimensions[i].getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) { actualIndexInSurrogateKey[index++] = Arrays.binarySearch(primitive, queryDimensions[i].getDimension().getOrdinal()); } } dictionaryEncodingArray = CarbonUtil.getDictionaryEncodingArray(queryDimensions); directDictionaryEncodingArray = CarbonUtil.getDirectDictionaryEncodingArray(queryDimensions); implictColumnArray = CarbonUtil.getImplicitColumnArray(queryDimensions); complexDataTypeArray = CarbonUtil.getComplexDataTypeArray(queryDimensions); order = new int[queryDimensions.length + queryMeasures.length]; for (int i = 0; i < queryDimensions.length; i++) { order[i] = queryDimensions[i].getQueryOrder(); } for (int i = 0; i < queryMeasures.length; i++) { order[i + queryDimensions.length] = queryMeasures[i].getQueryOrder(); } directDictionaryGenerators = new DirectDictionaryGenerator[queryDimensions.length]; for (int i = 0; i < queryDimensions.length; i++) { directDictionaryGenerators[i] = DirectDictionaryKeyGeneratorFactory .getDirectDictionaryGenerator(queryDimensions[i].getDimension().getDataType()); } }
From source file:org.apache.carbondata.core.scan.collector.impl.RestructureBasedRawResultCollector.java
/** * This method will create a new key generator for generating mdKey according to latest schema *///from w w w .j av a 2 s . co m private void initRestructuredKeyGenerator() { SegmentProperties segmentProperties = tableBlockExecutionInfos.getDataBlock().getSegmentProperties(); QueryDimension[] queryDimensions = tableBlockExecutionInfos.getActualQueryDimensions(); List<Integer> updatedColumnCardinality = new ArrayList<>(queryDimensions.length); List<Integer> updatedDimensionPartitioner = new ArrayList<>(queryDimensions.length); int[] dictionaryColumnBlockIndex = tableBlockExecutionInfos.getDictionaryColumnBlockIndex(); int dimCounterInCurrentBlock = 0; for (int i = 0; i < queryDimensions.length; i++) { if (queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY)) { if (tableBlockExecutionInfos.getDimensionInfo().getDimensionExists()[i]) { // get the dictionary key ordinal as column cardinality in segment properties // will only be for dictionary encoded columns CarbonDimension currentBlockDimension = segmentProperties.getDimensions() .get(dictionaryColumnBlockIndex[dimCounterInCurrentBlock]); updatedColumnCardinality.add( segmentProperties.getDimColumnsCardinality()[currentBlockDimension.getKeyOrdinal()]); updatedDimensionPartitioner .add(segmentProperties.getDimensionPartitions()[currentBlockDimension.getKeyOrdinal()]); dimCounterInCurrentBlock++; } else { // partitioner index will be 1 every column will be in columnar format updatedDimensionPartitioner.add(1); // for direct dictionary 4 bytes need to be allocated else 1 if (queryDimensions[i].getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) { updatedColumnCardinality.add(Integer.MAX_VALUE); } else { // cardinality will be 2 will user has provided a default value byte[] defaultValue = queryDimensions[i].getDimension().getDefaultValue(); if (null != defaultValue) { updatedColumnCardinality.add(CarbonCommonConstants.DICTIONARY_DEFAULT_CARDINALITY + 1); } else { updatedColumnCardinality.add(CarbonCommonConstants.DICTIONARY_DEFAULT_CARDINALITY); } } } } } if (!updatedColumnCardinality.isEmpty()) { int[] latestColumnCardinality = ArrayUtils .toPrimitive(updatedColumnCardinality.toArray(new Integer[updatedColumnCardinality.size()])); int[] latestColumnPartitioner = ArrayUtils.toPrimitive( updatedDimensionPartitioner.toArray(new Integer[updatedDimensionPartitioner.size()])); int[] dimensionBitLength = CarbonUtil.getDimensionBitLength(latestColumnCardinality, latestColumnPartitioner); restructuredKeyGenerator = new MultiDimKeyVarLengthGenerator(dimensionBitLength); } }
From source file:org.apache.carbondata.core.scan.executor.impl.AbstractQueryExecutor.java
/** * Below method will be used to get the block execution info which is * required to execute any block based on query model * * @param queryModel query model from user query * @param blockIndex block index// w w w .j ava 2 s.co m * @return block execution info * @throws QueryExecutionException any failure during block info creation */ protected BlockExecutionInfo getBlockExecutionInfoForBlock(QueryModel queryModel, AbstractIndex blockIndex, int startBlockletIndex, int numberOfBlockletToScan, String filePath) throws QueryExecutionException { BlockExecutionInfo blockExecutionInfo = new BlockExecutionInfo(); SegmentProperties segmentProperties = blockIndex.getSegmentProperties(); List<CarbonDimension> tableBlockDimensions = segmentProperties.getDimensions(); KeyGenerator blockKeyGenerator = segmentProperties.getDimensionKeyGenerator(); // below is to get only those dimension in query which is present in the // table block List<QueryDimension> currentBlockQueryDimensions = RestructureUtil .createDimensionInfoAndGetCurrentBlockQueryDimension(blockExecutionInfo, queryModel.getQueryDimension(), tableBlockDimensions, segmentProperties.getComplexDimensions()); int tableFactPathLength = CarbonStorePath .getCarbonTablePath(queryModel.getAbsoluteTableIdentifier().getStorePath(), queryModel.getAbsoluteTableIdentifier().getCarbonTableIdentifier()) .getFactDir().length() + 1; blockExecutionInfo.setBlockId(filePath.substring(tableFactPathLength)); blockExecutionInfo.setStartBlockletIndex(startBlockletIndex); blockExecutionInfo.setNumberOfBlockletToScan(numberOfBlockletToScan); blockExecutionInfo.setQueryDimensions( currentBlockQueryDimensions.toArray(new QueryDimension[currentBlockQueryDimensions.size()])); // get measures present in the current block List<QueryMeasure> currentBlockQueryMeasures = getCurrentBlockQueryMeasures(blockExecutionInfo, queryModel, blockIndex); blockExecutionInfo.setQueryMeasures( currentBlockQueryMeasures.toArray(new QueryMeasure[currentBlockQueryMeasures.size()])); blockExecutionInfo.setDataBlock(blockIndex); blockExecutionInfo.setBlockKeyGenerator(blockKeyGenerator); // setting whether raw record query or not blockExecutionInfo.setRawRecordDetailQuery(queryModel.isForcedDetailRawQuery()); // total number dimension blockExecutionInfo .setTotalNumberDimensionBlock(segmentProperties.getDimensionOrdinalToBlockMapping().size()); blockExecutionInfo .setTotalNumberOfMeasureBlock(segmentProperties.getMeasuresOrdinalToBlockMapping().size()); blockExecutionInfo.setAbsoluteTableIdentifier(queryModel.getAbsoluteTableIdentifier()); blockExecutionInfo.setComplexDimensionInfoMap(QueryUtil.getComplexDimensionsMap(currentBlockQueryDimensions, segmentProperties.getDimensionOrdinalToBlockMapping(), segmentProperties.getEachComplexDimColumnValueSize(), queryProperties.columnToDictionayMapping, queryProperties.complexFilterDimension)); IndexKey startIndexKey = null; IndexKey endIndexKey = null; if (null != queryModel.getFilterExpressionResolverTree()) { // loading the filter executer tree for filter evaluation blockExecutionInfo.setFilterExecuterTree( FilterUtil.getFilterExecuterTree(queryModel.getFilterExpressionResolverTree(), segmentProperties, blockExecutionInfo.getComlexDimensionInfoMap())); List<IndexKey> listOfStartEndKeys = new ArrayList<IndexKey>(2); FilterUtil.traverseResolverTreeAndGetStartAndEndKey(segmentProperties, queryModel.getFilterExpressionResolverTree(), listOfStartEndKeys); startIndexKey = listOfStartEndKeys.get(0); endIndexKey = listOfStartEndKeys.get(1); } else { try { startIndexKey = FilterUtil.prepareDefaultStartIndexKey(segmentProperties); endIndexKey = FilterUtil.prepareDefaultEndIndexKey(segmentProperties); } catch (KeyGenException e) { throw new QueryExecutionException(e); } } //setting the start index key of the block node blockExecutionInfo.setStartKey(startIndexKey); //setting the end index key of the block node blockExecutionInfo.setEndKey(endIndexKey); // expression dimensions List<CarbonDimension> expressionDimensions = new ArrayList<CarbonDimension>( CarbonCommonConstants.DEFAULT_COLLECTION_SIZE); // expression measure List<CarbonMeasure> expressionMeasures = new ArrayList<CarbonMeasure>( CarbonCommonConstants.DEFAULT_COLLECTION_SIZE); // setting all the dimension chunk indexes to be read from file int numberOfElementToConsider = 0; // list of dimensions to be projected Set<Integer> allProjectionListDimensionIdexes = new LinkedHashSet<>(); // create a list of filter dimensions present in the current block Set<CarbonDimension> currentBlockFilterDimensions = getCurrentBlockFilterDimensions( queryProperties.complexFilterDimension, segmentProperties); int[] dimensionsBlockIndexes = QueryUtil.getDimensionsBlockIndexes(currentBlockQueryDimensions, segmentProperties.getDimensionOrdinalToBlockMapping(), expressionDimensions, currentBlockFilterDimensions, allProjectionListDimensionIdexes); int numberOfColumnToBeReadInOneIO = Integer.parseInt(CarbonProperties.getInstance().getProperty( CarbonV3DataFormatConstants.NUMBER_OF_COLUMN_TO_READ_IN_IO, CarbonV3DataFormatConstants.NUMBER_OF_COLUMN_TO_READ_IN_IO_DEFAULTVALUE)); if (dimensionsBlockIndexes.length > 0) { numberOfElementToConsider = dimensionsBlockIndexes[dimensionsBlockIndexes.length - 1] == segmentProperties.getBlockTodimensionOrdinalMapping().size() - 1 ? dimensionsBlockIndexes.length - 1 : dimensionsBlockIndexes.length; blockExecutionInfo.setAllSelectedDimensionBlocksIndexes(CarbonUtil.getRangeIndex(dimensionsBlockIndexes, numberOfElementToConsider, numberOfColumnToBeReadInOneIO)); } else { blockExecutionInfo.setAllSelectedDimensionBlocksIndexes(new int[0][0]); } // get the list of updated filter measures present in the current block Set<CarbonMeasure> currentBlockFilterMeasures = getCurrentBlockFilterMeasures( queryProperties.filterMeasures, segmentProperties); // list of measures to be projected List<Integer> allProjectionListMeasureIndexes = new ArrayList<>(); int[] measureBlockIndexes = QueryUtil.getMeasureBlockIndexes(currentBlockQueryMeasures, expressionMeasures, segmentProperties.getMeasuresOrdinalToBlockMapping(), currentBlockFilterMeasures, allProjectionListMeasureIndexes); if (measureBlockIndexes.length > 0) { numberOfElementToConsider = measureBlockIndexes[measureBlockIndexes.length - 1] == segmentProperties .getMeasures().size() - 1 ? measureBlockIndexes.length - 1 : measureBlockIndexes.length; // setting all the measure chunk indexes to be read from file blockExecutionInfo.setAllSelectedMeasureBlocksIndexes(CarbonUtil.getRangeIndex(measureBlockIndexes, numberOfElementToConsider, numberOfColumnToBeReadInOneIO)); } else { blockExecutionInfo.setAllSelectedMeasureBlocksIndexes(new int[0][0]); } // setting the indexes of list of dimension in projection list blockExecutionInfo.setProjectionListDimensionIndexes(ArrayUtils.toPrimitive( allProjectionListDimensionIdexes.toArray(new Integer[allProjectionListDimensionIdexes.size()]))); // setting the indexes of list of measures in projection list blockExecutionInfo.setProjectionListMeasureIndexes(ArrayUtils.toPrimitive( allProjectionListMeasureIndexes.toArray(new Integer[allProjectionListMeasureIndexes.size()]))); // setting the size of fixed key column (dictionary column) blockExecutionInfo.setFixedLengthKeySize(getKeySize(currentBlockQueryDimensions, segmentProperties)); Set<Integer> dictionaryColumnBlockIndex = new HashSet<Integer>(); List<Integer> noDictionaryColumnBlockIndex = new ArrayList<Integer>(); // get the block index to be read from file for query dimension // for both dictionary columns and no dictionary columns QueryUtil.fillQueryDimensionsBlockIndexes(currentBlockQueryDimensions, segmentProperties.getDimensionOrdinalToBlockMapping(), dictionaryColumnBlockIndex, noDictionaryColumnBlockIndex); int[] queryDictionaryColumnBlockIndexes = ArrayUtils .toPrimitive(dictionaryColumnBlockIndex.toArray(new Integer[dictionaryColumnBlockIndex.size()])); // need to sort the dictionary column as for all dimension // column key will be filled based on key order Arrays.sort(queryDictionaryColumnBlockIndexes); blockExecutionInfo.setDictionaryColumnBlockIndex(queryDictionaryColumnBlockIndexes); // setting the no dictionary column block indexes blockExecutionInfo.setNoDictionaryBlockIndexes(ArrayUtils.toPrimitive( noDictionaryColumnBlockIndex.toArray(new Integer[noDictionaryColumnBlockIndex.size()]))); // setting column id to dictionary mapping blockExecutionInfo.setColumnIdToDcitionaryMapping(queryProperties.columnToDictionayMapping); // setting each column value size blockExecutionInfo.setEachColumnValueSize(segmentProperties.getEachDimColumnValueSize()); blockExecutionInfo.setComplexColumnParentBlockIndexes( getComplexDimensionParentBlockIndexes(currentBlockQueryDimensions)); blockExecutionInfo.setVectorBatchCollector(queryModel.isVectorReader()); try { // to set column group and its key structure info which will be used // to // for getting the column group column data in case of final row // and in case of dimension aggregation blockExecutionInfo.setColumnGroupToKeyStructureInfo( QueryUtil.getColumnGroupKeyStructureInfo(currentBlockQueryDimensions, segmentProperties)); } catch (KeyGenException e) { throw new QueryExecutionException(e); } // set actual query dimensions and measures. It may differ in case of restructure scenarios blockExecutionInfo.setActualQueryDimensions( queryModel.getQueryDimension().toArray(new QueryDimension[queryModel.getQueryDimension().size()])); blockExecutionInfo.setActualQueryMeasures( queryModel.getQueryMeasures().toArray(new QueryMeasure[queryModel.getQueryMeasures().size()])); return blockExecutionInfo; }
From source file:org.apache.carbondata.core.scan.executor.impl.AbstractQueryExecutor.java
/** * This method will be used to get fixed key length size this will be used * to create a row from column chunk/* w w w. j a v a 2s .com*/ * * @param queryDimension query dimension * @param blockMetadataInfo block metadata info * @return key size */ private int getKeySize(List<QueryDimension> queryDimension, SegmentProperties blockMetadataInfo) { // add the dimension block ordinal for each dictionary column // existing in the current block dimensions. Set is used because in case of column groups // ordinal of columns in a column group will be same Set<Integer> fixedLengthDimensionOrdinal = new HashSet<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE); int counter = 0; while (counter < queryDimension.size()) { if (queryDimension.get(counter).getDimension().numberOfChild() > 0) { counter += queryDimension.get(counter).getDimension().numberOfChild(); continue; } else if (!CarbonUtil.hasEncoding(queryDimension.get(counter).getDimension().getEncoder(), Encoding.DICTIONARY)) { counter++; } else { fixedLengthDimensionOrdinal.add(blockMetadataInfo.getDimensionOrdinalToBlockMapping() .get(queryDimension.get(counter).getDimension().getOrdinal())); counter++; } } int[] dictionaryColumnOrdinal = ArrayUtils .toPrimitive(fixedLengthDimensionOrdinal.toArray(new Integer[fixedLengthDimensionOrdinal.size()])); // calculate the size of existing query dictionary columns in this block if (dictionaryColumnOrdinal.length > 0) { int[] eachColumnValueSize = blockMetadataInfo.getEachDimColumnValueSize(); int keySize = 0; for (int i = 0; i < dictionaryColumnOrdinal.length; i++) { keySize += eachColumnValueSize[dictionaryColumnOrdinal[i]]; } return keySize; } return 0; }
From source file:org.apache.carbondata.core.scan.executor.impl.AbstractQueryExecutor.java
private int[] getComplexDimensionParentBlockIndexes(List<QueryDimension> queryDimensions) { List<Integer> parentBlockIndexList = new ArrayList<Integer>(); for (QueryDimension queryDimension : queryDimensions) { if (CarbonUtil.hasDataType(queryDimension.getDimension().getDataType(), new DataType[] { DataType.ARRAY, DataType.STRUCT, DataType.MAP })) { parentBlockIndexList.add(queryDimension.getDimension().getOrdinal()); }//from w ww . j ava2 s .c om } return ArrayUtils.toPrimitive(parentBlockIndexList.toArray(new Integer[parentBlockIndexList.size()])); }
From source file:org.apache.carbondata.core.scan.executor.util.QueryUtil.java
/** * Below method will be used to get the dimension block index in file based * on query dimension/* www . j a v a 2 s.c o m*/ * * @param queryDimensions query dimension * @param dimensionOrdinalToBlockMapping mapping of dimension block in file to query dimension * @return block index of file */ public static int[] getDimensionsBlockIndexes(List<QueryDimension> queryDimensions, Map<Integer, Integer> dimensionOrdinalToBlockMapping, List<CarbonDimension> customAggregationDimension, Set<CarbonDimension> filterDimensions, Set<Integer> allProjectionListDimensionIndexes) { // using set as in row group columns will point to same block Set<Integer> dimensionBlockIndex = new HashSet<Integer>(); Set<Integer> filterDimensionOrdinal = getFilterDimensionOrdinal(filterDimensions); int blockIndex = 0; for (int i = 0; i < queryDimensions.size(); i++) { if (queryDimensions.get(i).getDimension().hasEncoding(Encoding.IMPLICIT)) { continue; } Integer dimensionOrdinal = queryDimensions.get(i).getDimension().getOrdinal(); allProjectionListDimensionIndexes.add(dimensionOrdinalToBlockMapping.get(dimensionOrdinal)); if (queryDimensions.get(i).getDimension().numberOfChild() > 0) { addChildrenBlockIndex(allProjectionListDimensionIndexes, queryDimensions.get(i).getDimension()); } if (!filterDimensionOrdinal.contains(dimensionOrdinal)) { blockIndex = dimensionOrdinalToBlockMapping.get(dimensionOrdinal); dimensionBlockIndex.add(blockIndex); if (queryDimensions.get(i).getDimension().numberOfChild() > 0) { addChildrenBlockIndex(dimensionBlockIndex, queryDimensions.get(i).getDimension()); } } } for (int i = 0; i < customAggregationDimension.size(); i++) { blockIndex = dimensionOrdinalToBlockMapping.get(customAggregationDimension.get(i).getOrdinal()); // not adding the children dimension as dimension aggregation // is not push down in case of complex dimension dimensionBlockIndex.add(blockIndex); } int[] dimensionIndex = ArrayUtils .toPrimitive(dimensionBlockIndex.toArray(new Integer[dimensionBlockIndex.size()])); Arrays.sort(dimensionIndex); return dimensionIndex; }
From source file:org.apache.carbondata.core.scan.executor.util.QueryUtil.java
/** * Below method will used to get the method will be used to get the measure * block indexes to be read from the file * * @param queryMeasures query measure * @param expressionMeasure measure present in the expression * @param ordinalToBlockIndexMapping measure ordinal to block mapping * @return block indexes//from w w w . j a v a 2 s . c om */ public static int[] getMeasureBlockIndexes(List<QueryMeasure> queryMeasures, List<CarbonMeasure> expressionMeasure, Map<Integer, Integer> ordinalToBlockIndexMapping, Set<CarbonMeasure> filterMeasures, List<Integer> allProjectionListMeasureIdexes) { Set<Integer> measureBlockIndex = new HashSet<Integer>(); Set<Integer> filterMeasureOrdinal = getFilterMeasureOrdinal(filterMeasures); for (int i = 0; i < queryMeasures.size(); i++) { Integer measureOrdinal = queryMeasures.get(i).getMeasure().getOrdinal(); allProjectionListMeasureIdexes.add(measureOrdinal); if (!filterMeasureOrdinal.contains(measureOrdinal)) { measureBlockIndex.add(ordinalToBlockIndexMapping.get(measureOrdinal)); } } for (int i = 0; i < expressionMeasure.size(); i++) { measureBlockIndex.add(ordinalToBlockIndexMapping.get(expressionMeasure.get(i).getOrdinal())); } int[] measureIndexes = ArrayUtils .toPrimitive(measureBlockIndex.toArray(new Integer[measureBlockIndex.size()])); Arrays.sort(measureIndexes); return measureIndexes; }
From source file:org.apache.carbondata.core.scan.executor.util.QueryUtil.java
/** * Below method will be used to get the mapping of block index and its * restructuring info/*from w w w . j av a 2 s. c om*/ * * @param queryDimensions query dimension from query model * @param segmentProperties segment properties * @return map of block index to its restructuring info * @throws KeyGenException if problem while key generation */ public static Map<Integer, KeyStructureInfo> getColumnGroupKeyStructureInfo( List<QueryDimension> queryDimensions, SegmentProperties segmentProperties) throws KeyGenException { Map<Integer, KeyStructureInfo> rowGroupToItsRSInfo = new HashMap<Integer, KeyStructureInfo>(); // get column group id and its ordinal mapping of column group Map<Integer, List<Integer>> columnGroupAndItsOrdinalMappingForQuery = getColumnGroupAndItsOrdinalMapping( queryDimensions); Map<Integer, KeyGenerator> columnGroupAndItsKeygenartor = segmentProperties .getColumnGroupAndItsKeygenartor(); Iterator<Entry<Integer, List<Integer>>> iterator = columnGroupAndItsOrdinalMappingForQuery.entrySet() .iterator(); KeyStructureInfo restructureInfos = null; while (iterator.hasNext()) { Entry<Integer, List<Integer>> next = iterator.next(); KeyGenerator keyGenerator = columnGroupAndItsKeygenartor.get(next.getKey()); restructureInfos = new KeyStructureInfo(); // sort the ordinal List<Integer> ordinal = next.getValue(); List<Integer> mdKeyOrdinal = new ArrayList<Integer>(); //Un sorted List<Integer> mdKeyOrdinalForQuery = new ArrayList<Integer>(); for (Integer ord : ordinal) { mdKeyOrdinal.add(segmentProperties.getColumnGroupMdKeyOrdinal(next.getKey(), ord)); mdKeyOrdinalForQuery.add(segmentProperties.getColumnGroupMdKeyOrdinal(next.getKey(), ord)); } Collections.sort(mdKeyOrdinal); // get the masked byte range for column group int[] maskByteRanges = getMaskedByteRangeBasedOrdinal(mdKeyOrdinal, keyGenerator); // max key for column group byte[] maxKey = getMaxKeyBasedOnOrinal(mdKeyOrdinal, keyGenerator); restructureInfos.setKeyGenerator(keyGenerator); restructureInfos.setMaskByteRanges(maskByteRanges); restructureInfos.setMaxKey(maxKey); restructureInfos.setMdkeyQueryDimensionOrdinal( ArrayUtils.toPrimitive(mdKeyOrdinalForQuery.toArray(new Integer[mdKeyOrdinalForQuery.size()]))); rowGroupToItsRSInfo.put(segmentProperties.getDimensionOrdinalToBlockMapping().get(ordinal.get(0)), restructureInfos); } return rowGroupToItsRSInfo; }
From source file:org.apache.carbondata.core.scan.executor.util.QueryUtil.java
/** * below method will be used to get the actual type aggregator * * @param aggType/*from www .j av a 2s. c o m*/ * @return index in aggrgetor */ public static int[] getActualTypeIndex(List<String> aggType) { List<Integer> indexList = new ArrayList<Integer>(); for (int i = 0; i < aggType.size(); i++) { if (!CarbonCommonConstants.SUM.equals(aggType.get(i)) && !CarbonCommonConstants.AVERAGE.equals(aggType.get(i))) { indexList.add(i); } } return ArrayUtils.toPrimitive(indexList.toArray(new Integer[indexList.size()])); }