### Question:
MetastoreHiveStatisticsProvider implements HiveStatisticsProvider { @VisibleForTesting static Estimate calculateDataSizeForPartitioningKey( HiveColumnHandle column, Type type, List<HivePartition> partitions, Map<String, PartitionStatistics> statistics, double averageRowsPerPartition) { if (!hasDataSize(type)) { return Estimate.unknown(); } double dataSize = 0; for (HivePartition partition : partitions) { int length = getSize(partition.getKeys().get(column)); double rowCount = getPartitionRowCount(partition.getPartitionId(), statistics).orElse(averageRowsPerPartition); dataSize += length * rowCount; } return Estimate.of(dataSize); } MetastoreHiveStatisticsProvider(SemiTransactionalHiveMetastore metastore); @VisibleForTesting  MetastoreHiveStatisticsProvider(PartitionsStatisticsProvider statisticsProvider); @Override TableStatistics getTableStatistics(
            ConnectorSession session,
            SchemaTableName table,
            Map<String, ColumnHandle> columns,
            Map<String, Type> columnTypes,
            List<HivePartition> partitions); static OptionalDouble convertPartitionValueToDouble(Type type, Object value);  }### Answer:
@Test public void testCalculateDataSizeForPartitioningKey() { assertEquals( calculateDataSizeForPartitioningKey( PARTITION_COLUMN_2, BIGINT, ImmutableList.of(partition("p1=string1/p2=1234")), ImmutableMap.of("p1=string1/p2=1234", rowsCount(1000)), 2000), Estimate.unknown()); assertEquals( calculateDataSizeForPartitioningKey( PARTITION_COLUMN_1, VARCHAR, ImmutableList.of(partition("p1=string1/p2=1234")), ImmutableMap.of("p1=string1/p2=1234", rowsCount(1000)), 2000), Estimate.of(7000)); assertEquals( calculateDataSizeForPartitioningKey( PARTITION_COLUMN_1, VARCHAR, ImmutableList.of(partition("p1=string1/p2=1234")), ImmutableMap.of("p1=string1/p2=1234", PartitionStatistics.empty()), 2000), Estimate.of(14000)); assertEquals( calculateDataSizeForPartitioningKey( PARTITION_COLUMN_1, VARCHAR, ImmutableList.of(partition("p1=string1/p2=1234"), partition("p1=str2/p2=1234")), ImmutableMap.of("p1=string1/p2=1234", rowsCount(1000), "p1=str2/p2=1234", rowsCount(2000)), 3000), Estimate.of(15000)); assertEquals( calculateDataSizeForPartitioningKey( PARTITION_COLUMN_1, VARCHAR, ImmutableList.of(partition("p1=string1/p2=1234"), partition("p1=str2/p2=1234")), ImmutableMap.of("p1=string1/p2=1234", rowsCount(1000), "p1=str2/p2=1234", PartitionStatistics.empty()), 3000), Estimate.of(19000)); assertEquals( calculateDataSizeForPartitioningKey( PARTITION_COLUMN_1, VARCHAR, ImmutableList.of(partition("p1=string1/p2=1234"), partition("p1=str2/p2=1234")), ImmutableMap.of(), 3000), Estimate.of(33000)); assertEquals( calculateDataSizeForPartitioningKey( PARTITION_COLUMN_1, VARCHAR, ImmutableList.of(partition("p1=__HIVE_DEFAULT_PARTITION__/p2=1234"), partition("p1=str2/p2=1234")), ImmutableMap.of(), 3000), Estimate.of(12000)); }