Search in sources :

Example 1 with LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner 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 LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner 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 LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner 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 LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner 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 LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner 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

LocalQueryRunner (io.prestosql.testing.LocalQueryRunner)27 TpchConnectorFactory (io.prestosql.plugin.tpch.TpchConnectorFactory)19 Session (io.prestosql.Session)14 BeforeClass (org.testng.annotations.BeforeClass)9 ImmutableMap (com.google.common.collect.ImmutableMap)3 FeaturesConfig (io.prestosql.sql.analyzer.FeaturesConfig)3 TestingSession.testSessionBuilder (io.prestosql.testing.TestingSession.testSessionBuilder)3 Test (org.testng.annotations.Test)3 ImmutableList (com.google.common.collect.ImmutableList)2 HetuFileSystemClientPlugin (io.hetu.core.filesystem.HetuFileSystemClientPlugin)2 BenchmarkQueryRunner.createLocalQueryRunner (io.prestosql.benchmark.BenchmarkQueryRunner.createLocalQueryRunner)2 MockConnectorFactory (io.prestosql.connector.MockConnectorFactory)2 SessionPropertyManager (io.prestosql.metadata.SessionPropertyManager)2 MemoryConnectorFactory (io.prestosql.plugin.memory.MemoryConnectorFactory)2 TINY_SCHEMA_NAME (io.prestosql.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME)2 CatalogName (io.prestosql.spi.connector.CatalogName)2 ConnectorViewDefinition (io.prestosql.spi.connector.ConnectorViewDefinition)2 QualifiedObjectName (io.prestosql.spi.connector.QualifiedObjectName)2 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)2 Identity (io.prestosql.spi.security.Identity)2