/** * Returns the number of partitions for the specified column. * Returns {@link #INVALID_NUM_PARTITIONS} if it does not exist for the column. * * @param column Column for which to get number of partitions. * @return Number of partitions of the column. */ public int getNumPartitions(String column) { ColumnPartitionConfig config = _columnPartitionMap.get(column); return (config != null) ? config.getNumPartitions() : INVALID_NUM_PARTITIONS; }
public RealtimeColumnStatistics(ColumnDataSource dataSource, int[] sortedDocIdIterationOrder, ColumnPartitionConfig columnPartitionConfig) { _dataSource = dataSource; _sortedDocIdIterationOrder = sortedDocIdIterationOrder; _dictionaryReader = (MutableDictionary) dataSource.getDictionary(); _block = dataSource.nextBlock(); if (columnPartitionConfig != null) { String functionName = columnPartitionConfig.getFunctionName(); _numPartitions = columnPartitionConfig.getNumPartitions(); _partitionFunction = (functionName != null) ? PartitionFunctionFactory.getPartitionFunction(functionName, _numPartitions) : null; if (_partitionFunction != null) { // Iterate over the dictionary to check the partitioning _partitions = new HashSet<>(); int length = _dictionaryReader.length(); for (int i = 0; i < length; i++) { _partitions.add(_partitionFunction.getPartition(_dictionaryReader.get(i))); } } } }