Search in sources :

Example 6 with ParquetFileWriterConfig

use of com.facebook.presto.hive.ParquetFileWriterConfig in project presto by prestodb.

the class TestMetastoreHiveStatisticsProvider method testGetTableStatisticsEmpty.

@Test
public void testGetTableStatisticsEmpty() {
    String partitionName = "p1=string1/p2=1234";
    MetastoreHiveStatisticsProvider statisticsProvider = new MetastoreHiveStatisticsProvider((session, table, hivePartitions) -> ImmutableMap.of(partitionName, PartitionStatistics.empty()));
    TestingConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(new HiveClientConfig(), new OrcFileWriterConfig(), new ParquetFileWriterConfig(), new CacheConfig()).getSessionProperties());
    assertEquals(statisticsProvider.getTableStatistics(session, TABLE, ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of(partition(partitionName))), TableStatistics.empty());
}
Also used : TestingConnectorSession(com.facebook.presto.testing.TestingConnectorSession) OrcFileWriterConfig(com.facebook.presto.hive.OrcFileWriterConfig) CacheConfig(com.facebook.presto.cache.CacheConfig) HiveSessionProperties(com.facebook.presto.hive.HiveSessionProperties) ParquetFileWriterConfig(com.facebook.presto.hive.ParquetFileWriterConfig) HiveClientConfig(com.facebook.presto.hive.HiveClientConfig) Test(org.testng.annotations.Test)

Example 7 with ParquetFileWriterConfig

use of com.facebook.presto.hive.ParquetFileWriterConfig in project presto by prestodb.

the class TestMetastoreHiveStatisticsProvider method testGetTableStatisticsSampling.

@Test
public void testGetTableStatisticsSampling() {
    MetastoreHiveStatisticsProvider statisticsProvider = new MetastoreHiveStatisticsProvider((session, table, hivePartitions) -> {
        assertEquals(table, TABLE);
        assertEquals(hivePartitions.size(), 1);
        return ImmutableMap.of();
    });
    TestingConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(new HiveClientConfig().setPartitionStatisticsSampleSize(1), new OrcFileWriterConfig(), new ParquetFileWriterConfig(), new CacheConfig()).getSessionProperties());
    statisticsProvider.getTableStatistics(session, TABLE, ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of(partition("p1=string1/p2=1234"), partition("p1=string1/p2=1235")));
}
Also used : TestingConnectorSession(com.facebook.presto.testing.TestingConnectorSession) OrcFileWriterConfig(com.facebook.presto.hive.OrcFileWriterConfig) CacheConfig(com.facebook.presto.cache.CacheConfig) HiveSessionProperties(com.facebook.presto.hive.HiveSessionProperties) ParquetFileWriterConfig(com.facebook.presto.hive.ParquetFileWriterConfig) HiveClientConfig(com.facebook.presto.hive.HiveClientConfig) Test(org.testng.annotations.Test)

Aggregations

CacheConfig (com.facebook.presto.cache.CacheConfig)7 HiveClientConfig (com.facebook.presto.hive.HiveClientConfig)7 HiveSessionProperties (com.facebook.presto.hive.HiveSessionProperties)7 OrcFileWriterConfig (com.facebook.presto.hive.OrcFileWriterConfig)7 ParquetFileWriterConfig (com.facebook.presto.hive.ParquetFileWriterConfig)7 TestingConnectorSession (com.facebook.presto.testing.TestingConnectorSession)7 Test (org.testng.annotations.Test)5 HiveBasicStatistics (com.facebook.presto.hive.HiveBasicStatistics)3 PartitionStatistics (com.facebook.presto.hive.metastore.PartitionStatistics)3 MetastoreHiveStatisticsProvider.validatePartitionStatistics (com.facebook.presto.hive.statistics.MetastoreHiveStatisticsProvider.validatePartitionStatistics)3 HiveColumnHandle (com.facebook.presto.hive.HiveColumnHandle)2 ConnectorPageSource (com.facebook.presto.spi.ConnectorPageSource)2 ConnectorSession (com.facebook.presto.spi.ConnectorSession)2 DoubleRange (com.facebook.presto.spi.statistics.DoubleRange)2 TableStatistics (com.facebook.presto.spi.statistics.TableStatistics)2 AbstractIterator (com.google.common.collect.AbstractIterator)2 Iterator (java.util.Iterator)2 FileFormatDataSourceStats (com.facebook.presto.hive.FileFormatDataSourceStats)1 HiveBatchPageSourceFactory (com.facebook.presto.hive.HiveBatchPageSourceFactory)1 HivePartition (com.facebook.presto.hive.HivePartition)1