public TableStats merge(TableStats other, @Nullable Set<String> partitionKeys) {
        if (this.rowCount < 0 || other.rowCount < 0) {
            return TableStats.UNKNOWN;
        }
        long rowCount =
                this.rowCount >= 0 && other.rowCount >= 0
                        ? this.rowCount + other.rowCount
                        : UNKNOWN.rowCount;
        return new TableStats(rowCount, mergeColumnStates(other, partitionKeys));
    }
@Test
    void testMergeLackColumnStats() {
        Map<String, ColumnStats> colStats1 = new HashMap<>();
        colStats1.put("a", new ColumnStats(4L, 5L, 2D, 3, 15, 2));
        colStats1.put("b", new ColumnStats(4L, 5L, 2D, 3, 15, 2));
        TableStats stats1 = new TableStats(30, colStats1);

        Map<String, ColumnStats> colStats2 = new HashMap<>();
        colStats2.put("a", new ColumnStats(3L, 15L, 12D, 23, 35, 6));
        TableStats stats2 = new TableStats(32, colStats2);

        Map<String, ColumnStats> colStatsMerge = new HashMap<>();
        colStatsMerge.put("a", new ColumnStats(4L, 20L, 7D, 23, 35, 2));
        assertThat(stats1.merge(stats2, null)).isEqualTo(new TableStats(62, colStatsMerge));

        Map<String, ColumnStats> colStatsMerge2 = new HashMap<>();
        colStatsMerge2.put("a", new ColumnStats(4L, 20L, 7D, 23, 35, 2));
        assertThat(stats1.merge(stats2, new HashSet<>()))
                .isEqualTo(new TableStats(62, colStatsMerge2));

        // 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> colStatsMerge3 = new HashMap<>();
        colStatsMerge3.put("a", new ColumnStats(7L, 20L, 7D, 23, 35, 2));
        assertThat(stats1.merge(stats2, new HashSet<>(Collections.singletonList("a"))))
                .isEqualTo(new TableStats(62, colStatsMerge3));
    }