Search in sources :

Example 16 with QueryRunner

use of io.trino.testing.QueryRunner in project trino by trinodb.

the class TestUserImpersonationAccessControl method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    String securityConfigFile = getResource("access_control_rules.json").getPath();
    SystemAccessControl accessControl = new FileBasedSystemAccessControl.Factory().create(ImmutableMap.of(SECURITY_CONFIG_FILE, securityConfigFile));
    QueryRunner queryRunner = DistributedQueryRunner.builder(TEST_SESSION).setNodeCount(1).setSystemAccessControl(accessControl).build();
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of());
    return queryRunner;
}
Also used : FileBasedSystemAccessControl(io.trino.plugin.base.security.FileBasedSystemAccessControl) SystemAccessControl(io.trino.spi.security.SystemAccessControl) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) FileBasedSystemAccessControl(io.trino.plugin.base.security.FileBasedSystemAccessControl) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) QueryRunner(io.trino.testing.QueryRunner)

Example 17 with QueryRunner

use of io.trino.testing.QueryRunner in project trino by trinodb.

the class AbstractTestDeltaLakeCreateTableStatistics method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    this.bucketName = "delta-test-create-table-statistics-" + randomTableSuffix();
    DockerizedMinioDataLake dockerizedMinioDataLake = closeAfterClass(createDockerizedMinioDataLakeForDeltaLake(bucketName));
    ImmutableMap.Builder<String, String> queryRunnerProperties = ImmutableMap.builder();
    queryRunnerProperties.putAll(additionalProperties());
    QueryRunner queryRunner = DeltaLakeQueryRunner.createS3DeltaLakeQueryRunner(DELTA_CATALOG, SCHEMA, queryRunnerProperties.buildOrThrow(), dockerizedMinioDataLake.getMinioAddress(), dockerizedMinioDataLake.getTestingHadoop());
    return queryRunner;
}
Also used : DockerizedMinioDataLake(io.trino.plugin.deltalake.util.DockerizedMinioDataLake) ImmutableMap(com.google.common.collect.ImmutableMap) QueryRunner(io.trino.testing.QueryRunner)

Example 18 with QueryRunner

use of io.trino.testing.QueryRunner in project trino by trinodb.

the class TestIcebergTaskFailureRecoveryTest method createQueryRunner.

@Override
protected QueryRunner createQueryRunner(List<TpchTable<?>> requiredTpchTables, Map<String, String> configProperties, Map<String, String> coordinatorProperties) throws Exception {
    this.minioStorage = new MinioStorage("test-exchange-spooling-" + randomTableSuffix());
    minioStorage.start();
    return IcebergQueryRunner.builder().setInitialTables(requiredTpchTables).setCoordinatorProperties(coordinatorProperties).setExtraProperties(ImmutableMap.<String, String>builder().putAll(configProperties).put("enable-dynamic-filtering", "false").buildOrThrow()).setAdditionalSetup(runner -> {
        runner.installPlugin(new FileSystemExchangePlugin());
        runner.loadExchangeManager("filesystem", getExchangeManagerProperties(minioStorage));
    }).build();
}
Also used : TpchTable(io.trino.tpch.TpchTable) AfterClass(org.testng.annotations.AfterClass) List(java.util.List) MinioStorage(io.trino.plugin.exchange.containers.MinioStorage) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ImmutableMap(com.google.common.collect.ImmutableMap) FileSystemExchangePlugin(io.trino.plugin.exchange.FileSystemExchangePlugin) QueryRunner(io.trino.testing.QueryRunner) Map(java.util.Map) RetryPolicy(io.trino.operator.RetryPolicy) TestTable.randomTableSuffix(io.trino.testing.sql.TestTable.randomTableSuffix) MinioStorage.getExchangeManagerProperties(io.trino.plugin.exchange.containers.MinioStorage.getExchangeManagerProperties) MinioStorage(io.trino.plugin.exchange.containers.MinioStorage) FileSystemExchangePlugin(io.trino.plugin.exchange.FileSystemExchangePlugin)

Example 19 with QueryRunner

use of io.trino.testing.QueryRunner in project trino by trinodb.

the class TestDeltaLakeDelete method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    verify(!new ParquetWriterConfig().isParquetOptimizedWriterEnabled(), "This test assumes the optimized Parquet writer is disabled by default");
    this.dockerizedMinioDataLake = closeAfterClass(createDockerizedMinioDataLakeForDeltaLake(bucketName));
    QueryRunner queryRunner = DeltaLakeQueryRunner.createS3DeltaLakeQueryRunner(DELTA_CATALOG, SCHEMA, ImmutableMap.of("delta.enable-non-concurrent-writes", "true"), dockerizedMinioDataLake.getMinioAddress(), dockerizedMinioDataLake.getTestingHadoop());
    TpchTable.getTables().forEach(table -> queryRunner.execute(format("CREATE TABLE %s WITH (location = '%s') AS SELECT * FROM tpch.tiny.%1$s", table.getTableName(), getLocationForTable(table.getTableName()))));
    return queryRunner;
}
Also used : ParquetWriterConfig(io.trino.plugin.hive.parquet.ParquetWriterConfig) QueryRunner(io.trino.testing.QueryRunner)

Example 20 with QueryRunner

use of io.trino.testing.QueryRunner in project trino by trinodb.

the class TestDeltaLakeUpdate method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    verify(!new ParquetWriterConfig().isParquetOptimizedWriterEnabled(), "This test assumes the optimized Parquet writer is disabled by default");
    DockerizedMinioDataLake dockerizedMinioDataLake = closeAfterClass(createDockerizedMinioDataLakeForDeltaLake(bucketName));
    QueryRunner queryRunner = DeltaLakeQueryRunner.createS3DeltaLakeQueryRunner(DELTA_CATALOG, SCHEMA, ImmutableMap.of("delta.enable-non-concurrent-writes", "true"), dockerizedMinioDataLake.getMinioAddress(), dockerizedMinioDataLake.getTestingHadoop());
    TpchTable.getTables().forEach(table -> queryRunner.execute(format("CREATE TABLE %s WITH (location = '%s') AS SELECT * FROM tpch.tiny.%1$s", table.getTableName(), getLocationForTable(table.getTableName()))));
    return queryRunner;
}
Also used : ParquetWriterConfig(io.trino.plugin.hive.parquet.ParquetWriterConfig) DockerizedMinioDataLake(io.trino.plugin.deltalake.util.DockerizedMinioDataLake) QueryRunner(io.trino.testing.QueryRunner)

Aggregations

QueryRunner (io.trino.testing.QueryRunner)29 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)17 ImmutableMap (com.google.common.collect.ImmutableMap)13 Test (org.testng.annotations.Test)13 Session (io.trino.Session)12 ImmutableList (com.google.common.collect.ImmutableList)11 Optional (java.util.Optional)11 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)10 SchemaTableName (io.trino.spi.connector.SchemaTableName)9 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)9 List (java.util.List)9 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)8 ImmutableSet (com.google.common.collect.ImmutableSet)7 MockConnectorFactory (io.trino.connector.MockConnectorFactory)7 TpchPlugin (io.trino.plugin.tpch.TpchPlugin)7 MaterializedResult (io.trino.testing.MaterializedResult)7 String.format (java.lang.String.format)7 Map (java.util.Map)6 AfterClass (org.testng.annotations.AfterClass)6 Plugin (io.trino.spi.Plugin)5