Search in sources :

Example 66 with LocalQueryRunner

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

the class TestLocalQueries method createLocalQueryRunner.

public static LocalQueryRunner createLocalQueryRunner() {
    Session defaultSession = testSessionBuilder().setCatalog("local").setSchema(TINY_SCHEMA_NAME).setSystemProperty(PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN, "true").build();
    LocalQueryRunner localQueryRunner = LocalQueryRunner.builder(defaultSession).build();
    // add the tpch catalog
    // local queries run directly against the generator
    localQueryRunner.createCatalog(defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    localQueryRunner.addFunctions(CUSTOM_FUNCTIONS);
    return localQueryRunner;
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Session(io.trino.Session)

Aggregations

LocalQueryRunner (io.trino.testing.LocalQueryRunner)66 Session (io.trino.Session)28 TpchConnectorFactory (io.trino.plugin.tpch.TpchConnectorFactory)25 Test (org.testng.annotations.Test)22 ImmutableMap (com.google.common.collect.ImmutableMap)12 SchemaTableName (io.trino.spi.connector.SchemaTableName)12 ImmutableList (com.google.common.collect.ImmutableList)11 MockConnectorFactory (io.trino.connector.MockConnectorFactory)11 Optional (java.util.Optional)11 CatalogName (io.trino.connector.CatalogName)9 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)9 MockConnectorTableHandle (io.trino.connector.MockConnectorTableHandle)8 QualifiedObjectName (io.trino.metadata.QualifiedObjectName)8 CatalogSchemaTableName (io.trino.spi.connector.CatalogSchemaTableName)7 ColumnMetadata (io.trino.spi.connector.ColumnMetadata)7 TrinoException (io.trino.spi.TrinoException)6 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)6 ImmutableSet (com.google.common.collect.ImmutableSet)5 ColumnHandle (io.trino.spi.connector.ColumnHandle)5 List (java.util.List)5