deniskuzZ commented on code in PR #5822:
URL: https://github.com/apache/hive/pull/5822#discussion_r2102379019


##########
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/StatsUpdater.java:
##########
@@ -81,10 +83,14 @@ public void gatherStats(HiveConf hiveConf, CompactionInfo 
ci, Map<String, String
                 sb.append(")");
             }
             sb.append(" compute statistics");
-            if (!conf.getBoolVar(HiveConf.ConfVars.HIVE_STATS_AUTOGATHER) && 
ci.isMajorCompaction()) {
-                List<String> columnList = 
msc.findColumnsWithStats(CompactionInfo.compactionInfoToStruct(ci));
+            if (ci.isMajorCompaction()) {
+                List<String> columnList = 
msc.findColumnsWithStats(CompactionInfo.compactionInfoToStruct(ci)).stream()
+                        .filter(columnName -> 
!StatsSetupConst.areColumnStatsUptoDate(tableProperties, columnName))

Review Comment:
   maybe us `allMatch`
   ````
   boolean isStatsUpToDate = [columnList].stream.allMatch(columnName -> 
StatsSetupConst.areColumnStatsUptoDate(tableProperties, columnName))`
   ````
   or better create util method `StatsSetupConst.areColumnStatsUptoDate`?



##########
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/StatsUpdater.java:
##########
@@ -81,10 +83,14 @@ public void gatherStats(HiveConf hiveConf, CompactionInfo 
ci, Map<String, String
                 sb.append(")");
             }
             sb.append(" compute statistics");
-            if (!conf.getBoolVar(HiveConf.ConfVars.HIVE_STATS_AUTOGATHER) && 
ci.isMajorCompaction()) {
-                List<String> columnList = 
msc.findColumnsWithStats(CompactionInfo.compactionInfoToStruct(ci));
+            if (ci.isMajorCompaction()) {
+                List<String> columnList = 
msc.findColumnsWithStats(CompactionInfo.compactionInfoToStruct(ci)).stream()
+                        .filter(columnName -> 
!StatsSetupConst.areColumnStatsUptoDate(tableProperties, columnName))

Review Comment:
   maybe use `allMatch`
   ````
   boolean isStatsUpToDate = [columnList].stream.allMatch(columnName -> 
StatsSetupConst.areColumnStatsUptoDate(tableProperties, columnName))`
   ````
   or better create util method `StatsSetupConst.areColumnStatsUptoDate`?



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to