Search in sources :

Example 1 with MemoryConnectorFactory

use of io.prestosql.plugin.memory.MemoryConnectorFactory 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)

Example 2 with MemoryConnectorFactory

use of io.prestosql.plugin.memory.MemoryConnectorFactory 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)

Aggregations

MemoryConnectorFactory (io.prestosql.plugin.memory.MemoryConnectorFactory)2 TpchConnectorFactory (io.prestosql.plugin.tpch.TpchConnectorFactory)2 LocalQueryRunner (io.prestosql.testing.LocalQueryRunner)2 TempFolder (io.hetu.core.common.filesystem.TempFolder)1 HetuFileSystemClientPlugin (io.hetu.core.filesystem.HetuFileSystemClientPlugin)1 HetuMetastorePlugin (io.hetu.core.metastore.HetuMetastorePlugin)1 HashMap (java.util.HashMap)1