Search in sources :

Example 16 with TpchConnectorFactory

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

the class TestIterativeOptimizer method setUp.

@BeforeClass
public void setUp() {
    Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("local").setSchema("tiny").setSystemProperty("task_concurrency", "1").setSystemProperty("iterative_optimizer_timeout", "1ms");
    queryRunner = LocalQueryRunner.create(sessionBuilder.build());
    queryRunner.createCatalog(queryRunner.getDefaultSession().getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) Session(io.trino.Session) BeforeClass(org.testng.annotations.BeforeClass)

Example 17 with TpchConnectorFactory

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

the class BasePlanTest method createLocalQueryRunner.

// Subclasses should implement this method to inject their own query runners
protected LocalQueryRunner createLocalQueryRunner() {
    Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("local").setSchema("tiny").setSystemProperty("task_concurrency", // these tests don't handle exchanges from local parallel
    "1");
    sessionProperties.forEach(sessionBuilder::setSystemProperty);
    LocalQueryRunner queryRunner = LocalQueryRunner.create(sessionBuilder.build());
    queryRunner.createCatalog(queryRunner.getDefaultSession().getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    return queryRunner;
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Session(io.trino.Session)

Example 18 with TpchConnectorFactory

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

the class TestTransactionManager method testTransactionWorkflow.

@Test
public void testTransactionWorkflow() {
    try (LocalQueryRunner queryRunner = LocalQueryRunner.create(TEST_SESSION)) {
        TransactionManager transactionManager = queryRunner.getTransactionManager();
        queryRunner.createCatalog(CATALOG, new TpchConnectorFactory(), ImmutableMap.of());
        TransactionId transactionId = transactionManager.beginTransaction(false);
        assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
        TransactionInfo transactionInfo = transactionManager.getTransactionInfo(transactionId);
        assertFalse(transactionInfo.isAutoCommitContext());
        assertTrue(transactionInfo.getCatalogNames().isEmpty());
        assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
        ConnectorMetadata metadata = transactionManager.getOptionalCatalogMetadata(transactionId, CATALOG).get().getMetadata(TEST_SESSION);
        metadata.listSchemaNames(TEST_SESSION.toConnectorSession(CATALOG_NAME));
        transactionInfo = transactionManager.getTransactionInfo(transactionId);
        assertEquals(transactionInfo.getCatalogNames(), ImmutableList.of(CATALOG_NAME, INFORMATION_SCHEMA_ID, SYSTEM_TABLES_ID));
        assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
        getFutureValue(transactionManager.asyncCommit(transactionId));
        assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
    }
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) ConnectorMetadata(io.trino.spi.connector.ConnectorMetadata) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Test(org.testng.annotations.Test)

Example 19 with TpchConnectorFactory

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

the class TestWith 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 20 with TpchConnectorFactory

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

the class StatsCalculatorTester method createQueryRunner.

private static LocalQueryRunner createQueryRunner(Session session) {
    LocalQueryRunner queryRunner = LocalQueryRunner.create(session);
    queryRunner.createCatalog(session.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    return queryRunner;
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) LocalQueryRunner(io.trino.testing.LocalQueryRunner)

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