godfreyhe commented on a change in pull request #10315: [FLINK-14552][table] 
Enable partition statistics in blink planner
URL: https://github.com/apache/flink/pull/10315#discussion_r353017040
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/plan/stats/TableStats.java
 ##########
 @@ -69,4 +70,18 @@ public TableStats copy() {
                return copy;
        }
 
+       public TableStats merge(TableStats other) {
+               Map<String, ColumnStats> colStats = new HashMap<>();
+               for (Map.Entry<String, ColumnStats> entry : 
this.colStats.entrySet()) {
+                       String col = entry.getKey();
+                       ColumnStats stats = entry.getValue();
+                       ColumnStats otherStats = other.colStats.get(col);
+                       if (otherStats != null) {
+                               colStats.put(col, stats.merge(otherStats));
+                       }
+               }
+               return new TableStats(
+                               Stream.of(this.rowCount, 
other.rowCount).anyMatch(c -> c == UNKNOWN.rowCount) ?
 
 Review comment:
   i think the logic will be more robustness , like `this.rowCount >=0 && 
other.rowCount >= 0 ? ...` not `c == UNKNOWN.rowCount` (it's a public 
interface, other negative number may also be given by user) 
   
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to