deniskuzZ commented on code in PR #6491:
URL: https://github.com/apache/hive/pull/6491#discussion_r3248245024
##########
ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java:
##########
@@ -239,22 +239,29 @@ public static long getNumRows(HiveConf conf,
List<ColumnInfo> schema, Table tabl
return aggregateStat.getNumRows();
}
- private static void estimateStatsForMissingCols(List<String> neededColumns,
List<ColStatistics> columnStats,
+ private static List<ColStatistics> estimateStatsForMissingCols(
+ List<String> neededColumns, List<ColStatistics> existingColStats,
HiveConf conf, long nr, List<ColumnInfo> schema) {
Set<String> neededCols = new HashSet<>(neededColumns);
Set<String> colsWithStats = new HashSet<>();
+ List<ColStatistics> neededColStats = new ArrayList<>(neededCols.size());
Review Comment:
can we simplify?
````
private static List<ColStatistics> estimateStatsForMissingCols(
List<String> neededColumns, List<ColStatistics> existingColStats,
HiveConf conf, long nr, List<ColumnInfo> schema) {
Set<String> missingCols = new HashSet<>(neededColumns);
List<ColStatistics> neededColStats = new ArrayList<>(neededColumns.size());
for (ColStatistics cs : existingColStats) {
if (missingCols.remove(cs.getColumnName())) {
neededColStats.add(cs);
}
}
if (!missingCols.isEmpty()) {
neededColStats.addAll(estimateStats(schema, new
ArrayList<>(missingCols), conf, nr));
}
return neededColStats;
}
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]