Search in sources :

Example 1 with ICEBERG_CATALOG

use of io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG in project trino by trinodb.

the class TestSharedGlueMetastore method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    Session icebergSession = testSessionBuilder().setCatalog(ICEBERG_CATALOG).setSchema(schema).build();
    Session hiveSession = testSessionBuilder().setCatalog(HIVE_CATALOG).setSchema(schema).build();
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(icebergSession).build();
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.createCatalog("tpch", "tpch");
    this.dataDirectory = queryRunner.getCoordinator().getBaseDataDir().resolve("iceberg_data");
    this.dataDirectory.toFile().deleteOnExit();
    queryRunner.installPlugin(new IcebergPlugin());
    queryRunner.createCatalog(ICEBERG_CATALOG, "iceberg", ImmutableMap.of("iceberg.catalog.type", "glue", "hive.metastore.glue.default-warehouse-dir", dataDirectory.toString()));
    HdfsConfig hdfsConfig = new HdfsConfig();
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hdfsConfig), ImmutableSet.of()), hdfsConfig, new NoHdfsAuthentication());
    this.glueMetastore = new GlueHiveMetastore(hdfsEnvironment, new GlueHiveMetastoreConfig(), directExecutor(), new DefaultGlueColumnStatisticsProviderFactory(new GlueHiveMetastoreConfig(), directExecutor(), directExecutor()), Optional.empty(), table -> true);
    queryRunner.installPlugin(new TestingHivePlugin(glueMetastore));
    queryRunner.createCatalog(HIVE_CATALOG, "hive");
    queryRunner.createCatalog("hive_with_redirections", "hive", ImmutableMap.of("hive.iceberg-catalog-name", "iceberg"));
    queryRunner.execute("CREATE SCHEMA " + schema + " WITH (location = '" + dataDirectory.toString() + "')");
    copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, icebergSession, ImmutableList.of(TpchTable.NATION));
    copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, hiveSession, ImmutableList.of(TpchTable.REGION));
    return queryRunner;
}
Also used : Logger(io.airlift.log.Logger) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) NoHdfsAuthentication(io.trino.plugin.hive.authentication.NoHdfsAuthentication) AbstractTestQueryFramework(io.trino.testing.AbstractTestQueryFramework) GlueHiveMetastoreConfig(io.trino.plugin.hive.metastore.glue.GlueHiveMetastoreConfig) HiveMetastore(io.trino.plugin.hive.metastore.HiveMetastore) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) ImmutableList(com.google.common.collect.ImmutableList) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) QueryAssertions.copyTpchTables(io.trino.testing.QueryAssertions.copyTpchTables) HiveHdfsConfiguration(io.trino.plugin.hive.HiveHdfsConfiguration) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) Path(java.nio.file.Path) TestTable.randomTableSuffix(io.trino.testing.sql.TestTable.randomTableSuffix) TpchTable(io.trino.tpch.TpchTable) AfterClass(org.testng.annotations.AfterClass) TINY_SCHEMA_NAME(io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME) ImmutableSet(com.google.common.collect.ImmutableSet) HdfsEnvironment(io.trino.plugin.hive.HdfsEnvironment) ImmutableMap(com.google.common.collect.ImmutableMap) String.format(java.lang.String.format) MoreExecutors.directExecutor(com.google.common.util.concurrent.MoreExecutors.directExecutor) DefaultGlueColumnStatisticsProviderFactory(io.trino.plugin.hive.metastore.glue.DefaultGlueColumnStatisticsProviderFactory) ICEBERG_CATALOG(io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG) TestingSession.testSessionBuilder(io.trino.testing.TestingSession.testSessionBuilder) GlueHiveMetastore(io.trino.plugin.hive.metastore.glue.GlueHiveMetastore) HdfsConfig(io.trino.plugin.hive.HdfsConfig) QueryRunner(io.trino.testing.QueryRunner) HdfsConfigurationInitializer(io.trino.plugin.hive.HdfsConfigurationInitializer) TestingHivePlugin(io.trino.plugin.hive.TestingHivePlugin) Optional(java.util.Optional) Session(io.trino.Session) HdfsConfigurationInitializer(io.trino.plugin.hive.HdfsConfigurationInitializer) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) HiveHdfsConfiguration(io.trino.plugin.hive.HiveHdfsConfiguration) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) TestingHivePlugin(io.trino.plugin.hive.TestingHivePlugin) HdfsConfig(io.trino.plugin.hive.HdfsConfig) NoHdfsAuthentication(io.trino.plugin.hive.authentication.NoHdfsAuthentication) DefaultGlueColumnStatisticsProviderFactory(io.trino.plugin.hive.metastore.glue.DefaultGlueColumnStatisticsProviderFactory) HdfsEnvironment(io.trino.plugin.hive.HdfsEnvironment) GlueHiveMetastore(io.trino.plugin.hive.metastore.glue.GlueHiveMetastore) GlueHiveMetastoreConfig(io.trino.plugin.hive.metastore.glue.GlueHiveMetastoreConfig) Session(io.trino.Session)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 MoreExecutors.directExecutor (com.google.common.util.concurrent.MoreExecutors.directExecutor)1 Logger (io.airlift.log.Logger)1 Session (io.trino.Session)1 HdfsConfig (io.trino.plugin.hive.HdfsConfig)1 HdfsConfigurationInitializer (io.trino.plugin.hive.HdfsConfigurationInitializer)1 HdfsEnvironment (io.trino.plugin.hive.HdfsEnvironment)1 HiveHdfsConfiguration (io.trino.plugin.hive.HiveHdfsConfiguration)1 TestingHivePlugin (io.trino.plugin.hive.TestingHivePlugin)1 NoHdfsAuthentication (io.trino.plugin.hive.authentication.NoHdfsAuthentication)1 HiveMetastore (io.trino.plugin.hive.metastore.HiveMetastore)1 DefaultGlueColumnStatisticsProviderFactory (io.trino.plugin.hive.metastore.glue.DefaultGlueColumnStatisticsProviderFactory)1 GlueHiveMetastore (io.trino.plugin.hive.metastore.glue.GlueHiveMetastore)1 GlueHiveMetastoreConfig (io.trino.plugin.hive.metastore.glue.GlueHiveMetastoreConfig)1 ICEBERG_CATALOG (io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG)1 TINY_SCHEMA_NAME (io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME)1 TpchPlugin (io.trino.plugin.tpch.TpchPlugin)1 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)1