Search in sources :

Example 26 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class TestBeginQuery method setUp.

@BeforeClass
public void setUp() {
    metadata = new TestMetadata();
    getQueryRunner().installPlugin(new TestPlugin(metadata));
    getQueryRunner().installPlugin(new TpchPlugin());
    getQueryRunner().createCatalog("test", "test", ImmutableMap.of());
    getQueryRunner().createCatalog("tpch", "tpch", ImmutableMap.of());
}
Also used : TpchPlugin(io.trino.plugin.tpch.TpchPlugin) BeforeClass(org.testng.annotations.BeforeClass)

Example 27 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class H2TestUtil method createQueryRunner.

public static DistributedQueryRunner createQueryRunner(String dbConfigUrl, H2ResourceGroupsDao dao, String environment) throws Exception {
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(testSessionBuilder().setCatalog("tpch").setSchema("tiny").build()).setNodeCount(2).setEnvironment(environment).build();
    try {
        Plugin h2ResourceGroupManagerPlugin = new H2ResourceGroupManagerPlugin();
        queryRunner.installPlugin(h2ResourceGroupManagerPlugin);
        queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager(CONFIGURATION_MANAGER_TYPE, ImmutableMap.of("resource-groups.config-db-url", dbConfigUrl, "node.environment", environment));
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        setup(queryRunner, dao, environment);
        return queryRunner;
    } catch (Exception e) {
        queryRunner.close();
        throw e;
    }
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) TrinoException(io.trino.spi.TrinoException) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) Plugin(io.trino.spi.Plugin)

Example 28 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin 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 29 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class BaseQueryAssertionsTest method configureCatalog.

protected void configureCatalog(QueryRunner queryRunner) {
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of());
    queryRunner.installPlugin(new JdbcPlugin("base-jdbc", new TestingH2JdbcModule()));
    Map<String, String> jdbcConfigurationProperties = TestingH2JdbcModule.createProperties();
    queryRunner.createCatalog("jdbc", "base-jdbc", jdbcConfigurationProperties);
    try (Connection connection = DriverManager.getConnection(jdbcConfigurationProperties.get("connection-url"));
        Statement statement = connection.createStatement()) {
        statement.execute("CREATE SCHEMA " + "tpch");
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
    copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, queryRunner.getDefaultSession(), List.of(NATION));
    Map<String, String> jdbcWithAggregationPushdownDisabledConfigurationProperties = ImmutableMap.<String, String>builder().putAll(jdbcConfigurationProperties).put("aggregation-pushdown.enabled", "false").buildOrThrow();
    queryRunner.createCatalog("jdbc_with_aggregation_pushdown_disabled", "base-jdbc", jdbcWithAggregationPushdownDisabledConfigurationProperties);
}
Also used : JdbcPlugin(io.trino.plugin.jdbc.JdbcPlugin) TestingH2JdbcModule(io.trino.plugin.jdbc.TestingH2JdbcModule) SQLException(java.sql.SQLException) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) Statement(java.sql.Statement) Connection(java.sql.Connection)

Example 30 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class BlackHoleQueryRunner method createQueryRunner.

public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception {
    Session session = testSessionBuilder().setCatalog("blackhole").setSchema("default").build();
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(4).setExtraProperties(extraProperties).build();
    try {
        queryRunner.installPlugin(new BlackHolePlugin());
        queryRunner.createCatalog("blackhole", "blackhole", ImmutableMap.of());
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of());
        return queryRunner;
    } catch (Exception e) {
        closeAllSuppress(e, queryRunner);
        throw e;
    }
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) Session(io.trino.Session)

Aggregations

TpchPlugin (io.trino.plugin.tpch.TpchPlugin)49 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)39 Session (io.trino.Session)16 BeforeClass (org.testng.annotations.BeforeClass)8 ImmutableList (com.google.common.collect.ImmutableList)7 ImmutableMap (com.google.common.collect.ImmutableMap)7 QueryRunner (io.trino.testing.QueryRunner)7 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)7 File (java.io.File)7 ImmutableSet (com.google.common.collect.ImmutableSet)6 SchemaTableName (io.trino.spi.connector.SchemaTableName)6 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)6 Optional (java.util.Optional)6 Test (org.testng.annotations.Test)6 MockConnectorFactory (io.trino.connector.MockConnectorFactory)5 Plugin (io.trino.spi.Plugin)5 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)4 MockConnectorTableHandle (io.trino.connector.MockConnectorTableHandle)3 BlackHolePlugin (io.trino.plugin.blackhole.BlackHolePlugin)3 BIGINT (io.trino.spi.type.BigintType.BIGINT)3