Search in sources :

Example 21 with TpchConnectorFactory

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

the class TestCostCalculator method setUp.

@BeforeClass
public void setUp() {
    TaskCountEstimator taskCountEstimator = new TaskCountEstimator(() -> NUMBER_OF_NODES);
    costCalculatorUsingExchanges = new CostCalculatorUsingExchanges(taskCountEstimator);
    costCalculatorWithEstimatedExchanges = new CostCalculatorWithEstimatedExchanges(costCalculatorUsingExchanges, taskCountEstimator);
    session = testSessionBuilder().setCatalog("tpch").build();
    localQueryRunner = LocalQueryRunner.create(session);
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(), ImmutableMap.of());
    planFragmenter = new PlanFragmenter(localQueryRunner.getMetadata(), localQueryRunner.getFunctionManager(), localQueryRunner.getNodePartitioningManager(), new QueryManagerConfig());
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) PlanFragmenter(io.trino.sql.planner.PlanFragmenter) QueryManagerConfig(io.trino.execution.QueryManagerConfig) BeforeClass(org.testng.annotations.BeforeClass)

Example 22 with TpchConnectorFactory

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

the class HiveBenchmarkQueryRunner method createLocalQueryRunner.

public static LocalQueryRunner createLocalQueryRunner(File tempDir) {
    Session session = testSessionBuilder().setCatalog("hive").setSchema("tpch").build();
    LocalQueryRunner localQueryRunner = LocalQueryRunner.create(session);
    // add tpch
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
    // add hive
    File hiveDir = new File(tempDir, "hive_data");
    HiveMetastore metastore = createTestingFileHiveMetastore(hiveDir);
    metastore.createDatabase(Database.builder().setDatabaseName("tpch").setOwnerName(Optional.of("public")).setOwnerType(Optional.of(PrincipalType.ROLE)).build());
    Map<String, String> hiveCatalogConfig = ImmutableMap.<String, String>builder().put("hive.max-split-size", "10GB").buildOrThrow();
    localQueryRunner.createCatalog("hive", new TestingHiveConnectorFactory(metastore), hiveCatalogConfig);
    localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders");
    localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem");
    return localQueryRunner;
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) HiveMetastore(io.trino.plugin.hive.metastore.HiveMetastore) FileHiveMetastore.createTestingFileHiveMetastore(io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore) File(java.io.File) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Session(io.trino.Session)

Example 23 with TpchConnectorFactory

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

the class TestFilterInaccessibleColumns method init.

@BeforeClass
public void init() {
    LocalQueryRunner runner = LocalQueryRunner.builder(SESSION).withFeaturesConfig(new FeaturesConfig().setHideInaccessibleColumns(true)).build();
    runner.createCatalog(CATALOG, new TpchConnectorFactory(1), ImmutableMap.of());
    assertions = new QueryAssertions(runner);
    accessControl = assertions.getQueryRunner().getAccessControl();
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) FeaturesConfig(io.trino.FeaturesConfig) LocalQueryRunner(io.trino.testing.LocalQueryRunner) BeforeClass(org.testng.annotations.BeforeClass)

Example 24 with TpchConnectorFactory

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

the class TestNestedLogicalBinaryExpression method init.

@BeforeAll
public void init() {
    Session session = testSessionBuilder().setCatalog(CATALOG).setSchema(TINY_SCHEMA_NAME).build();
    LocalQueryRunner runner = LocalQueryRunner.builder(session).build();
    runner.createCatalog(CATALOG, new TpchConnectorFactory(1), ImmutableMap.of());
    assertions = new QueryAssertions(runner);
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Session(io.trino.Session) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 25 with TpchConnectorFactory

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

the class TestMLQueries method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() {
    Session defaultSession = testSessionBuilder().setCatalog("local").setSchema(TINY_SCHEMA_NAME).build();
    LocalQueryRunner localQueryRunner = LocalQueryRunner.create(defaultSession);
    // add the tpch catalog
    // local queries run directly against the generator
    localQueryRunner.createCatalog(defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    localQueryRunner.installPlugin(new MLPlugin());
    return localQueryRunner;
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Session(io.trino.Session)

Aggregations

TpchConnectorFactory (io.trino.plugin.tpch.TpchConnectorFactory)31 LocalQueryRunner (io.trino.testing.LocalQueryRunner)25 Session (io.trino.Session)17 BeforeClass (org.testng.annotations.BeforeClass)7 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)5 BeforeAll (org.junit.jupiter.api.BeforeAll)5 ImmutableList (com.google.common.collect.ImmutableList)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 FeaturesConfig (io.trino.FeaturesConfig)3 ConnectorMetadata (io.trino.spi.connector.ConnectorMetadata)3 Optional (java.util.Optional)3 Test (org.testng.annotations.Test)3 SessionBuilder (io.trino.Session.SessionBuilder)2 TPCH_NATION_WITH_HIDDEN_COLUMN (io.trino.connector.MockConnectorEntities.TPCH_NATION_WITH_HIDDEN_COLUMN)2 TPCH_WITH_HIDDEN_COLUMN_DATA (io.trino.connector.MockConnectorEntities.TPCH_WITH_HIDDEN_COLUMN_DATA)2 MockConnectorFactory (io.trino.connector.MockConnectorFactory)2 QualifiedObjectName (io.trino.metadata.QualifiedObjectName)2 MemoryConnectorFactory (io.trino.plugin.memory.MemoryConnectorFactory)2 TINY_SCHEMA_NAME (io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME)2 ConnectorViewDefinition (io.trino.spi.connector.ConnectorViewDefinition)2