private static Map<String, Map<ColumnStatisticType, Block>> createColumnToComputedStatisticsMap(Map<ColumnStatisticMetadata, Block> computedStatistics) { Map<String, Map<ColumnStatisticType, Block>> result = new HashMap<>(); computedStatistics.forEach((metadata, block) -> { Map<ColumnStatisticType, Block> columnStatistics = result.computeIfAbsent(metadata.getColumnName(), key -> new HashMap<>()); columnStatistics.put(metadata.getStatisticType(), block); }); return result.entrySet() .stream() .collect(toImmutableMap(Entry::getKey, entry -> ImmutableMap.copyOf(entry.getValue()))); }
@VisibleForTesting static String serialize(ColumnStatisticMetadata value) { return value.getStatisticType().name() + ":" + value.getColumnName(); } }
private void printStatisticAggregationsInfo( Map<TableStatisticType, Symbol> tableStatistics, Map<ColumnStatisticMetadata, Symbol> columnStatistics, Map<Symbol, Aggregation> aggregations, int indent) { print(indent, "aggregations =>"); for (Map.Entry<TableStatisticType, Symbol> tableStatistic : tableStatistics.entrySet()) { print( indent + 1, "%s => [%s := %s]", tableStatistic.getValue(), tableStatistic.getKey(), aggregations.get(tableStatistic.getValue()).getCall()); } for (Map.Entry<ColumnStatisticMetadata, Symbol> columnStatistic : columnStatistics.entrySet()) { print( indent + 1, "%s[%s] => [%s := %s]", columnStatistic.getKey().getStatisticType(), columnStatistic.getKey().getColumnName(), columnStatistic.getValue(), aggregations.get(columnStatistic.getValue()).getCall()); } }
ColumnStatisticType statisticType = columnStatisticMetadata.getStatisticType(); Symbol inputSymbol = columnToSymbolMap.get(columnName); verify(inputSymbol != null, "inputSymbol is null");