Search in sources :

Example 1 with MetaDirStatisticsAccess

use of io.trino.plugin.deltalake.statistics.MetaDirStatisticsAccess in project trino by trinodb.

the class TestDeltaLakeMetastoreStatistics method setupMetastore.

@BeforeClass
public void setupMetastore() {
    TestingConnectorContext context = new TestingConnectorContext();
    TypeManager typeManager = context.getTypeManager();
    CheckpointSchemaManager checkpointSchemaManager = new CheckpointSchemaManager(typeManager);
    HdfsConfig hdfsConfig = new HdfsConfig();
    HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hdfsConfig), ImmutableSet.of());
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hdfsConfig, new NoHdfsAuthentication());
    FileFormatDataSourceStats fileFormatDataSourceStats = new FileFormatDataSourceStats();
    TransactionLogAccess transactionLogAccess = new TransactionLogAccess(typeManager, checkpointSchemaManager, new DeltaLakeConfig(), fileFormatDataSourceStats, hdfsEnvironment, new ParquetReaderConfig(), new DeltaLakeConfig());
    File tmpDir = Files.createTempDir();
    File metastoreDir = new File(tmpDir, "metastore");
    hiveMetastore = new FileHiveMetastore(new NodeVersion("test_version"), hdfsEnvironment, new MetastoreConfig(), new FileHiveMetastoreConfig().setCatalogDirectory(metastoreDir.toURI().toString()).setMetastoreUser("test"));
    hiveMetastore.createDatabase(new Database("db_name", Optional.empty(), Optional.of("test"), Optional.of(PrincipalType.USER), Optional.empty(), ImmutableMap.of()));
    CachingDeltaLakeStatisticsAccess statistics = new CachingDeltaLakeStatisticsAccess(new MetaDirStatisticsAccess(hdfsEnvironment, new JsonCodecFactory().jsonCodec(DeltaLakeStatistics.class)));
    deltaLakeMetastore = new HiveMetastoreBackedDeltaLakeMetastore(hiveMetastore, transactionLogAccess, typeManager, statistics);
}
Also used : DeltaLakeConfig(io.trino.plugin.deltalake.DeltaLakeConfig) HdfsConfigurationInitializer(io.trino.plugin.hive.HdfsConfigurationInitializer) HiveHdfsConfiguration(io.trino.plugin.hive.HiveHdfsConfiguration) MetastoreConfig(io.trino.plugin.hive.metastore.MetastoreConfig) FileHiveMetastoreConfig(io.trino.plugin.hive.metastore.file.FileHiveMetastoreConfig) MetaDirStatisticsAccess(io.trino.plugin.deltalake.statistics.MetaDirStatisticsAccess) HdfsConfig(io.trino.plugin.hive.HdfsConfig) TransactionLogAccess(io.trino.plugin.deltalake.transactionlog.TransactionLogAccess) FileFormatDataSourceStats(io.trino.plugin.hive.FileFormatDataSourceStats) TestingConnectorContext(io.trino.testing.TestingConnectorContext) HiveHdfsConfiguration(io.trino.plugin.hive.HiveHdfsConfiguration) HdfsConfiguration(io.trino.plugin.hive.HdfsConfiguration) NoHdfsAuthentication(io.trino.plugin.hive.authentication.NoHdfsAuthentication) HdfsEnvironment(io.trino.plugin.hive.HdfsEnvironment) NodeVersion(io.trino.plugin.hive.NodeVersion) FileHiveMetastoreConfig(io.trino.plugin.hive.metastore.file.FileHiveMetastoreConfig) FileHiveMetastore(io.trino.plugin.hive.metastore.file.FileHiveMetastore) CheckpointSchemaManager(io.trino.plugin.deltalake.transactionlog.checkpoint.CheckpointSchemaManager) Database(io.trino.plugin.hive.metastore.Database) TypeManager(io.trino.spi.type.TypeManager) CachingDeltaLakeStatisticsAccess(io.trino.plugin.deltalake.statistics.CachingDeltaLakeStatisticsAccess) File(java.io.File) JsonCodecFactory(io.airlift.json.JsonCodecFactory) ParquetReaderConfig(io.trino.plugin.hive.parquet.ParquetReaderConfig) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

JsonCodecFactory (io.airlift.json.JsonCodecFactory)1 DeltaLakeConfig (io.trino.plugin.deltalake.DeltaLakeConfig)1 CachingDeltaLakeStatisticsAccess (io.trino.plugin.deltalake.statistics.CachingDeltaLakeStatisticsAccess)1 MetaDirStatisticsAccess (io.trino.plugin.deltalake.statistics.MetaDirStatisticsAccess)1 TransactionLogAccess (io.trino.plugin.deltalake.transactionlog.TransactionLogAccess)1 CheckpointSchemaManager (io.trino.plugin.deltalake.transactionlog.checkpoint.CheckpointSchemaManager)1 FileFormatDataSourceStats (io.trino.plugin.hive.FileFormatDataSourceStats)1 HdfsConfig (io.trino.plugin.hive.HdfsConfig)1 HdfsConfiguration (io.trino.plugin.hive.HdfsConfiguration)1 HdfsConfigurationInitializer (io.trino.plugin.hive.HdfsConfigurationInitializer)1 HdfsEnvironment (io.trino.plugin.hive.HdfsEnvironment)1 HiveHdfsConfiguration (io.trino.plugin.hive.HiveHdfsConfiguration)1 NodeVersion (io.trino.plugin.hive.NodeVersion)1 NoHdfsAuthentication (io.trino.plugin.hive.authentication.NoHdfsAuthentication)1 Database (io.trino.plugin.hive.metastore.Database)1 MetastoreConfig (io.trino.plugin.hive.metastore.MetastoreConfig)1 FileHiveMetastore (io.trino.plugin.hive.metastore.file.FileHiveMetastore)1 FileHiveMetastoreConfig (io.trino.plugin.hive.metastore.file.FileHiveMetastoreConfig)1 ParquetReaderConfig (io.trino.plugin.hive.parquet.ParquetReaderConfig)1 TypeManager (io.trino.spi.type.TypeManager)1