@VisibleForTesting
    static long calculateDistinctPartitionKeys(
            HiveColumnHandle column,
            List<HivePartition> partitions)
    {
        return partitions.stream()
                .map(partition -> partition.getKeys().get(column))
                .filter(value -> !value.isNull())
                .distinct()
                .count();
    }
@Test
    public void testCalculateDistinctPartitionKeys()
    {
        assertEquals(calculateDistinctPartitionKeys(PARTITION_COLUMN_1, ImmutableList.of()), 0);
        assertEquals(
                calculateDistinctPartitionKeys(
                        PARTITION_COLUMN_1,
                        ImmutableList.of(partition("p1=string1/p2=1234"))),
                1);
        assertEquals(
                calculateDistinctPartitionKeys(
                        PARTITION_COLUMN_1,
                        ImmutableList.of(partition("p1=string1/p2=1234"), partition("p1=string2/p2=1234"))),
                2);
        assertEquals(
                calculateDistinctPartitionKeys(
                        PARTITION_COLUMN_2,
                        ImmutableList.of(partition("p1=string1/p2=1234"), partition("p1=string2/p2=1234"))),
                1);
        assertEquals(
                calculateDistinctPartitionKeys(
                        PARTITION_COLUMN_2,
                        ImmutableList.of(partition("p1=string1/p2=1234"), partition("p1=string1/p2=1235"))),
                2);
        assertEquals(
                calculateDistinctPartitionKeys(
                        PARTITION_COLUMN_1,
                        ImmutableList.of(partition("p1=__HIVE_DEFAULT_PARTITION__/p2=1234"), partition("p1=string1/p2=1235"))),
                1);
        assertEquals(
                calculateDistinctPartitionKeys(
                        PARTITION_COLUMN_2,
                        ImmutableList.of(partition("p1=123/p2=__HIVE_DEFAULT_PARTITION__"), partition("p1=string1/p2=1235"))),
                1);
        assertEquals(
                calculateDistinctPartitionKeys(
                        PARTITION_COLUMN_2,
                        ImmutableList.of(partition("p1=123/p2=__HIVE_DEFAULT_PARTITION__"), partition("p1=string1/p2=__HIVE_DEFAULT_PARTITION__"))),
                0);
    }