Source:
<code>public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { Table table = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); List<String> dataColumns = table.getDataColumns().stream() .map(Column::getName) .collect(toImmutableList()); List<String> partitionColumns = table.getPartitionColumns().stream() .map(Column::getName) .collect(toImmutableList()); Map<String, HiveBasicStatistics> partitionBasicStatistics = getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)).entrySet().stream() .filter(entry -> entry.getValue().isPresent()) .collect(toImmutableMap( entry -> FileUtils.makePartName(partitionColumns, entry.getValue().get().getValues()), entry -> getHiveBasicStatistics(entry.getValue().get().getParameters()))); Map<String, OptionalLong> partitionRowCounts = partitionBasicStatistics.entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, entry -> entry.getValue().getRowCount())); <START> Map<String, List<ColumnStatisticsInfo>> colStatsMap = null; <END> try { colStatsMap = client.getPartitionColumnStatistics(table.getDatabaseName(), table.getTableName(), partitionBasicStatistics.keySet().stream().collect(toImmutableList()), dataColumns); } catch (AlluxioStatusException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } Map<String, Map<String, HiveColumnStatistics>> partitionColumnStatistics = colStatsMap.entrySet().stream() .filter(entry -> !entry.getValue().isEmpty()) .collect(toImmutableMap( Map.Entry::getKey, entry -> groupStatisticsByColumn(entry.getValue(), partitionRowCounts.getOrDefault(entry.getKey(), OptionalLong.empty())))); ImmutableMap.Builder<String, PartitionStatistics> result = ImmutableMap.builder(); for (String partitionName : partitionBasicStatistics.keySet()) { HiveBasicStatistics basicStatistics = partitionBasicStatistics.get(partitionName); Map<String, HiveColumnStatistics> columnStatistics = partitionColumnStatistics.getOrDefault(partitionName, ImmutableMap.of()); result.put(partitionName, new PartitionStatistics(basicStatistics, columnStatistics)); } return result.build(); }</code><technical_language>spell out colStatsMap - null assignment is useless</technical_language>

Target:
public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { Table table = getTable(databaseName, tableName).orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); Map<String, HiveBasicStatistics> partitionBasicStatistics = getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)).entrySet().stream() .filter(entry -> entry.getValue().isPresent()) .collect(toImmutableMap( entry -> MetastoreUtil.makePartName(table.getPartitionColumns(), entry.getValue().get().getValues()), entry -> getHiveBasicStatistics(entry.getValue().get().getParameters()))); Map<String, OptionalLong> partitionRowCounts = partitionBasicStatistics.entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, entry -> entry.getValue().getRowCount())); List<String> dataColumns = table.getDataColumns().stream() .map(Column::getName) .collect(toImmutableList()); Map<String, List<ColumnStatisticsInfo>> columnStatisticss; try { columnStatisticss = client.getPartitionColumnStatistics( table.getDatabaseName(), table.getTableName(), partitionBasicStatistics.keySet().stream().collect(toImmutableList()), dataColumns); } catch (AlluxioStatusException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } Map<String, Map<String, HiveColumnStatistics>> partitionColumnStatistics = columnStatisticss.entrySet().stream() .filter(entry -> !entry.getValue().isEmpty()) .collect(toImmutableMap( Map.Entry::getKey, entry -> groupStatisticsByColumn(entry.getValue(), partitionRowCounts.getOrDefault(entry.getKey(), OptionalLong.empty())))); ImmutableMap.Builder<String, PartitionStatistics> result = ImmutableMap.builder(); for (String partitionName : partitionBasicStatistics.keySet()) { HiveBasicStatistics basicStatistics = partitionBasicStatistics.get(partitionName); Map<String, HiveColumnStatistics> columnStatistics = partitionColumnStatistics.getOrDefault(partitionName, ImmutableMap.of()); result.put(partitionName, new PartitionStatistics(basicStatistics, columnStatistics)); } return result.build(); }