Search in sources :

Example 1 with JdbcPlugin

use of io.trino.plugin.jdbc.JdbcPlugin 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)

Aggregations

JdbcPlugin (io.trino.plugin.jdbc.JdbcPlugin)1 TestingH2JdbcModule (io.trino.plugin.jdbc.TestingH2JdbcModule)1 TpchPlugin (io.trino.plugin.tpch.TpchPlugin)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1