Search in sources :

Example 6 with TpchConnectorFactory

use of io.prestosql.plugin.tpch.TpchConnectorFactory in project hetu-core by openlookeng.

the class BasePlanTest method createQueryRunner.

private static LocalQueryRunner createQueryRunner(Map<String, String> sessionProperties) {
    Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("local").setSchema("tiny").setSystemProperty("task_concurrency", // these tests don't handle exchanges from local parallel
    "1");
    sessionProperties.entrySet().forEach(entry -> sessionBuilder.setSystemProperty(entry.getKey(), entry.getValue()));
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(sessionBuilder.build());
    localQueryRunner.createCatalog(localQueryRunner.getDefaultSession().getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    return localQueryRunner;
}
Also used : TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) Session(io.prestosql.Session)

Example 7 with TpchConnectorFactory

use of io.prestosql.plugin.tpch.TpchConnectorFactory in project hetu-core by openlookeng.

the class TestTransactionManager method testAbortedTransactionWorkflow.

@Test
public void testAbortedTransactionWorkflow() {
    try (IdleCheckExecutor executor = new IdleCheckExecutor()) {
        CatalogManager catalogManager = new CatalogManager();
        TransactionManager transactionManager = InMemoryTransactionManager.create(new TransactionManagerConfig(), executor.getExecutor(), catalogManager, finishingExecutor);
        Connector c1 = new TpchConnectorFactory().create(CATALOG, ImmutableMap.of(), new TestingConnectorContext());
        registerConnector(catalogManager, transactionManager, CATALOG, CATALOG_NAME, c1);
        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();
        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.asyncAbort(transactionId));
        assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
    }
}
Also used : Connector(io.prestosql.spi.connector.Connector) InformationSchemaConnector(io.prestosql.connector.informationschema.InformationSchemaConnector) SystemConnector(io.prestosql.connector.system.SystemConnector) TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) TestingConnectorContext(io.prestosql.testing.TestingConnectorContext) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata) CatalogManager(io.prestosql.metadata.CatalogManager) Test(org.testng.annotations.Test)

Example 8 with TpchConnectorFactory

use of io.prestosql.plugin.tpch.TpchConnectorFactory in project hetu-core by openlookeng.

the class TestRowFilter method init.

@BeforeClass
public void init() {
    LocalQueryRunner runner = new LocalQueryRunner(SESSION);
    runner.createCatalog(CATALOG, new TpchConnectorFactory(1), ImmutableMap.of());
    ConnectorViewDefinition view = new ConnectorViewDefinition("SELECT nationkey, name FROM local.tiny.nation", Optional.empty(), Optional.empty(), ImmutableList.of(new ConnectorViewDefinition.ViewColumn("nationkey", BigintType.BIGINT.getTypeSignature()), new ConnectorViewDefinition.ViewColumn("name", VarcharType.createVarcharType(25).getTypeSignature())), Optional.of(VIEW_OWNER), false);
    MockConnectorFactory mock = MockConnectorFactory.builder().withGetViews((s, prefix) -> ImmutableMap.<SchemaTableName, ConnectorViewDefinition>builder().put(new SchemaTableName("default", "nation_view"), view).build()).build();
    runner.createCatalog(MOCK_CATALOG, mock, ImmutableMap.of());
    assertions = new QueryAssertions(runner);
    accessControl = assertions.getQueryRunner().getAccessControl();
}
Also used : BigintType(io.prestosql.spi.type.BigintType) AfterClass(org.testng.annotations.AfterClass) ImmutableMap(com.google.common.collect.ImmutableMap) TINY_SCHEMA_NAME(io.prestosql.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME) ConnectorViewDefinition(io.prestosql.spi.connector.ConnectorViewDefinition) BeforeClass(org.testng.annotations.BeforeClass) TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) ViewExpression(io.prestosql.spi.security.ViewExpression) Identity(io.prestosql.spi.security.Identity) Test(org.testng.annotations.Test) MockConnectorFactory(io.prestosql.connector.MockConnectorFactory) QualifiedObjectName(io.prestosql.spi.connector.QualifiedObjectName) TestingSession.testSessionBuilder(io.prestosql.testing.TestingSession.testSessionBuilder) TestingAccessControlManager(io.prestosql.testing.TestingAccessControlManager) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) ImmutableList(com.google.common.collect.ImmutableList) Session(io.prestosql.Session) Optional(java.util.Optional) VarcharType(io.prestosql.spi.type.VarcharType) TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) MockConnectorFactory(io.prestosql.connector.MockConnectorFactory) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) ConnectorViewDefinition(io.prestosql.spi.connector.ConnectorViewDefinition) BeforeClass(org.testng.annotations.BeforeClass)

Example 9 with TpchConnectorFactory

use of io.prestosql.plugin.tpch.TpchConnectorFactory in project hetu-core by openlookeng.

the class TestHiddenColumns method setUp.

@BeforeClass
public void setUp() {
    runner = new LocalQueryRunner(TEST_SESSION);
    runner.createCatalog(TEST_SESSION.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
}
Also used : TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) BeforeClass(org.testng.annotations.BeforeClass)

Example 10 with TpchConnectorFactory

use of io.prestosql.plugin.tpch.TpchConnectorFactory in project hetu-core by openlookeng.

the class MemoryLocalQueryRunner method createMemoryLocalQueryRunner.

private static LocalQueryRunner createMemoryLocalQueryRunner(Session session) {
    LocalQueryRunner queryRunnerWithInitialTransaction = LocalQueryRunner.queryRunnerWithInitialTransaction(session);
    // add tpch
    queryRunnerWithInitialTransaction.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
    queryRunnerWithInitialTransaction.createCatalog("memory", new MemoryConnectorFactory(), ImmutableMap.of("memory.max-data-per-node", "4GB"));
    return queryRunnerWithInitialTransaction;
}
Also used : TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) MemoryConnectorFactory(io.prestosql.plugin.memory.MemoryConnectorFactory) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner)

Aggregations

TpchConnectorFactory (io.prestosql.plugin.tpch.TpchConnectorFactory)25 LocalQueryRunner (io.prestosql.testing.LocalQueryRunner)20 Session (io.prestosql.Session)14 BeforeClass (org.testng.annotations.BeforeClass)7 Test (org.testng.annotations.Test)5 InformationSchemaConnector (io.prestosql.connector.informationschema.InformationSchemaConnector)4 SystemConnector (io.prestosql.connector.system.SystemConnector)4 Connector (io.prestosql.spi.connector.Connector)4 TestingConnectorContext (io.prestosql.testing.TestingConnectorContext)4 CatalogManager (io.prestosql.metadata.CatalogManager)3 CatalogName (io.prestosql.spi.connector.CatalogName)3 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)3 TestingSession.testSessionBuilder (io.prestosql.testing.TestingSession.testSessionBuilder)3 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 HetuFileSystemClientPlugin (io.hetu.core.filesystem.HetuFileSystemClientPlugin)2 MockConnectorFactory (io.prestosql.connector.MockConnectorFactory)2 SessionPropertyManager (io.prestosql.metadata.SessionPropertyManager)2 HiveIdentity (io.prestosql.plugin.hive.authentication.HiveIdentity)2 HiveMetastore (io.prestosql.plugin.hive.metastore.HiveMetastore)2