@Override
    public TableStatistics getTableStatistics(
            ConnectorSession session,
            SchemaTableName table,
            Map<String, ColumnHandle> columns,
            Map<String, Type> columnTypes,
            List<HivePartition> partitions)
    {
        if (!isStatisticsEnabled(session)) {
            return TableStatistics.empty();
        }
        if (partitions.isEmpty()) {
            return createZeroStatistics(columns, columnTypes);
        }
        int sampleSize = getPartitionStatisticsSampleSize(session);
        List<HivePartition> partitionsSample = getPartitionsSample(partitions, sampleSize);
        try {
            Map<String, PartitionStatistics> statisticsSample = statisticsProvider.getPartitionsStatistics(session, table, partitionsSample);
            validatePartitionStatistics(table, statisticsSample);
            return getTableStatistics(columns, columnTypes, partitions, statisticsSample);
        }
        catch (PrestoException e) {
            if (e.getErrorCode().equals(HIVE_CORRUPTED_COLUMN_STATISTICS.toErrorCode()) && isIgnoreCorruptedStatistics(session)) {
                log.error(e);
                return TableStatistics.empty();
            }
            throw e;
        }
    }
@Test
    public void testGetTableStatistics()
    {
        String partitionName = "p1=string1/p2=1234";
        PartitionStatistics statistics = PartitionStatistics.builder()
                .setBasicStatistics(new HiveBasicStatistics(OptionalLong.empty(), OptionalLong.of(1000), OptionalLong.of(5000), OptionalLong.empty()))
                .setColumnStatistics(ImmutableMap.of(COLUMN, createIntegerColumnStatistics(OptionalLong.of(-100), OptionalLong.of(100), OptionalLong.of(500), OptionalLong.of(300))))
                .build();
        MetastoreHiveStatisticsProvider statisticsProvider = new MetastoreHiveStatisticsProvider((session, table, hivePartitions) -> ImmutableMap.of(partitionName, statistics), quickStatsProvider);
        TestingConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(
                new HiveClientConfig(),
                new OrcFileWriterConfig(),
                new ParquetFileWriterConfig(),
                new CacheConfig()).getSessionProperties());
        HiveColumnHandle columnHandle = new HiveColumnHandle(COLUMN, HIVE_LONG, BIGINT.getTypeSignature(), 2, REGULAR, Optional.empty(), Optional.empty());
        TableStatistics expected = TableStatistics.builder()
                .setRowCount(Estimate.of(1000))
                .setTotalSize(Estimate.of(5000))
                .setColumnStatistics(
                        PARTITION_COLUMN_1,
                        ColumnStatistics.builder()
                                .setDataSize(Estimate.of(7000))
                                .setNullsFraction(Estimate.of(0))
                                .setDistinctValuesCount(Estimate.of(1))
                                .build())
                .setColumnStatistics(
                        PARTITION_COLUMN_2,
                        ColumnStatistics.builder()
                                .setRange(new DoubleRange(1234, 1234))
                                .setNullsFraction(Estimate.of(0))
                                .setDistinctValuesCount(Estimate.of(1))
                                .build())
                .setColumnStatistics(
                        columnHandle,
                        ColumnStatistics.builder()
                                .setRange(new DoubleRange(-100, 100))
                                .setNullsFraction(Estimate.of(0.5))
                                .setDistinctValuesCount(Estimate.of(300))
                                .build())
                .build();
        assertEquals(
                statisticsProvider.getTableStatistics(
                        session,
                        TABLE,
                        ImmutableMap.of(
                                "p1", PARTITION_COLUMN_1,
                                "p2", PARTITION_COLUMN_2,
                                COLUMN, columnHandle),
                        ImmutableMap.of(
                                "p1", VARCHAR,
                                "p2", BIGINT,
                                COLUMN, BIGINT),
                        ImmutableList.of(partition(partitionName))),
                expected);
    }