swuferhong commented on code in PR #20595: URL: https://github.com/apache/flink/pull/20595#discussion_r948948574
########## flink-table/flink-table-common/src/test/java/org/apache/flink/table/plan/stats/TableStatsTest.java: ########## @@ -55,23 +63,29 @@ void testMergeLackColumnStats() { TableStats stats2 = new TableStats(32, colStats2); Map<String, ColumnStats> colStatsMerge = new HashMap<>(); - colStatsMerge.put("a", new ColumnStats(7L, 20L, 7D, 23, 35, 2)); - assertThat(stats1.merge(stats2)).isEqualTo(new TableStats(62, colStatsMerge)); + colStatsMerge.put("a", new ColumnStats(4L, 20L, 7D, 23, 35, 2)); + assertThat(stats1.merge(stats2, null)).isEqualTo(new TableStats(62, colStatsMerge)); + // test column stats merge while column 'a' is partition key. Merged Ndv for columns which + // are partition keys using sum instead of max. + Map<String, ColumnStats> colStatsMerge2 = new HashMap<>(); + colStatsMerge2.put("a", new ColumnStats(7L, 20L, 7D, 23, 35, 2)); + assertThat(stats1.merge(stats2, new HashSet<>(Collections.singletonList("a")))) + .isEqualTo(new TableStats(62, colStatsMerge2)); Review Comment: > Done! -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org