Search in sources :

Example 11 with LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner in project hetu-core by openlookeng.

the class StatisticsBenchmark method main.

public static void main(String... args) {
    LocalQueryRunner localQueryRunner = createLocalQueryRunner();
    new LongVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
    new LongVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
    new DoubleVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
    new DoubleVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
    new LongStdDevBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
    new LongStdDevPopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
    new DoubleStdDevBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
    new DoubleStdDevPopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
}
Also used : LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) BenchmarkQueryRunner.createLocalQueryRunner(io.prestosql.benchmark.BenchmarkQueryRunner.createLocalQueryRunner)

Example 12 with LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner in project hetu-core by openlookeng.

the class TestSpatialJoinPlanning method createQueryRunner.

private static LocalQueryRunner createQueryRunner() throws IOException {
    LocalQueryRunner queryRunner = new LocalQueryRunner(testSessionBuilder().setCatalog("memory").setSchema("default").build());
    queryRunner.installPlugin(new HetuFileSystemClientPlugin());
    queryRunner.installPlugin(new HetuMetastorePlugin());
    queryRunner.installPlugin(new GeoPlugin());
    queryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
    TempFolder folder = new TempFolder().create();
    Runtime.getRuntime().addShutdownHook(new Thread(folder::close));
    HashMap<String, String> metastoreConfig = new HashMap<>();
    metastoreConfig.put("hetu.metastore.type", "hetufilesystem");
    metastoreConfig.put("hetu.metastore.hetufilesystem.profile-name", "default");
    metastoreConfig.put("hetu.metastore.hetufilesystem.path", folder.newFolder("metastore").getAbsolutePath());
    metastoreConfig.put("hetu.metastore.cache.type", "local");
    queryRunner.loadMetastore(metastoreConfig);
    queryRunner.createCatalog("memory", new MemoryConnectorFactory(), ImmutableMap.of("memory.spill-path", folder.newFolder("memory-connector").getAbsolutePath()));
    queryRunner.execute(format("CREATE TABLE kdb_tree AS SELECT '%s' AS v", KDB_TREE_JSON));
    queryRunner.execute("CREATE TABLE points (lng, lat, name) AS (VALUES (2.1e0, 2.1e0, 'x'))");
    queryRunner.execute("CREATE TABLE polygons (wkt, name) AS (VALUES ('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))', 'a'))");
    return queryRunner;
}
Also used : HetuFileSystemClientPlugin(io.hetu.core.filesystem.HetuFileSystemClientPlugin) TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) HetuMetastorePlugin(io.hetu.core.metastore.HetuMetastorePlugin) HashMap(java.util.HashMap) TempFolder(io.hetu.core.common.filesystem.TempFolder) MemoryConnectorFactory(io.prestosql.plugin.memory.MemoryConnectorFactory) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner)

Example 13 with LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner in project hetu-core by openlookeng.

the class TestSpatialJoinPlanning method assertInvalidSpatialPartitioning.

private void assertInvalidSpatialPartitioning(Session session, String sql, String expectedMessageRegExp) {
    LocalQueryRunner queryRunner = getQueryRunner();
    try {
        queryRunner.inTransaction(session, transactionSession -> {
            queryRunner.createPlan(transactionSession, sql, LogicalPlanner.Stage.OPTIMIZED_AND_VALIDATED, false, WarningCollector.NOOP);
            return null;
        });
        fail(format("Expected query to fail: %s", sql));
    } catch (PrestoException ex) {
        assertEquals(ex.getErrorCode(), INVALID_SPATIAL_PARTITIONING.toErrorCode());
        if (!nullToEmpty(ex.getMessage()).matches(expectedMessageRegExp)) {
            fail(format("Expected exception message '%s' to match '%s' for query: %s", ex.getMessage(), expectedMessageRegExp, sql), ex);
        }
    }
}
Also used : PrestoException(io.prestosql.spi.PrestoException) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner)

Example 14 with LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner in project hetu-core by openlookeng.

the class StatsCalculatorTester method createQueryRunner.

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

Example 15 with LocalQueryRunner

use of io.prestosql.testing.LocalQueryRunner in project hetu-core by openlookeng.

the class TestPlannerWarnings method setUp.

@BeforeClass
public void setUp() {
    queryRunner = new LocalQueryRunner(testSessionBuilder().setCatalog("local").setSchema("tiny").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) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

LocalQueryRunner (io.prestosql.testing.LocalQueryRunner)29 TpchConnectorFactory (io.prestosql.plugin.tpch.TpchConnectorFactory)20 Session (io.prestosql.Session)15 BeforeClass (org.testng.annotations.BeforeClass)9 File (java.io.File)4 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 BenchmarkSuite (io.prestosql.benchmark.BenchmarkSuite)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 FileHiveMetastore.createTestingFileHiveMetastore (io.prestosql.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore)2 MemoryConnectorFactory (io.prestosql.plugin.memory.MemoryConnectorFactory)2 TINY_SCHEMA_NAME (io.prestosql.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME)2