Search in sources :

Example 1 with TpchConnectorFactory

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

the class TestColumnMask 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 2 with TpchConnectorFactory

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

the class TestQueryPlanDeterminism method createLocalQueryRunner.

private static LocalQueryRunner createLocalQueryRunner() {
    Session defaultSession = testSessionBuilder().setCatalog("local").setSchema(TINY_SCHEMA_NAME).build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
    // add the tpch catalog
    // local queries run directly against the generator
    localQueryRunner.createCatalog(defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    localQueryRunner.getMetadata().getFunctionAndTypeManager().registerBuiltInFunctions(CUSTOM_FUNCTIONS);
    SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
    sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
    sessionPropertyManager.addConnectorSessionProperties(new CatalogName(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
    return localQueryRunner;
}
Also used : TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) SessionPropertyManager(io.prestosql.metadata.SessionPropertyManager) CatalogName(io.prestosql.spi.connector.CatalogName) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) Session(io.prestosql.Session)

Example 3 with TpchConnectorFactory

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

the class TestQuerySpillLimits method createLocalQueryRunner.

private LocalQueryRunner createLocalQueryRunner(NodeSpillConfig nodeSpillConfig) {
    LocalQueryRunner queryRunner = null;
    try {
        String canonicalPath = spillPath.getCanonicalPath();
        queryRunner = new LocalQueryRunner(SESSION, new FeaturesConfig().setSpillerSpillPaths(canonicalPath).setSpillEnabled(true), nodeSpillConfig, false, true);
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
    queryRunner.createCatalog(SESSION.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    queryRunner.installPlugin(new HetuFileSystemClientPlugin());
    return queryRunner;
}
Also used : HetuFileSystemClientPlugin(io.hetu.core.filesystem.HetuFileSystemClientPlugin) TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) FeaturesConfig(io.prestosql.sql.analyzer.FeaturesConfig) IOException(java.io.IOException) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner)

Example 4 with TpchConnectorFactory

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

the class TestTpchLocalStats method setUp.

@BeforeClass
public void setUp() {
    Session defaultSession = testSessionBuilder().setCatalog("tpch").setSchema(TINY_SCHEMA_NAME).setSystemProperty(PREFER_PARTIAL_AGGREGATION, "false").build();
    LocalQueryRunner queryRunner = new LocalQueryRunner(defaultSession);
    queryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name()));
    statisticsAssertion = new StatisticsAssertion(queryRunner);
}
Also used : TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) StatisticsAssertion(io.prestosql.tests.statistics.StatisticsAssertion) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) Session(io.prestosql.Session) BeforeClass(org.testng.annotations.BeforeClass)

Example 5 with TpchConnectorFactory

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

the class TestIterativeOptimizer method setUp.

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

Aggregations

TpchConnectorFactory (io.prestosql.plugin.tpch.TpchConnectorFactory)24 LocalQueryRunner (io.prestosql.testing.LocalQueryRunner)19 Session (io.prestosql.Session)13 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 FeaturesConfig (io.prestosql.sql.analyzer.FeaturesConfig)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 MemoryConnectorFactory (io.prestosql.plugin.memory.MemoryConnectorFactory)2