Search in sources :

Example 26 with TpchPlugin

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

the class TestPrestoDriverAuth method setup.

@BeforeClass
public void setup() throws Exception {
    Logging.initialize();
    URL resource = getClass().getClassLoader().getResource("33.privateKey");
    assertNotNull(resource, "key directory not found");
    File keyDir = new File(resource.getFile()).getAbsoluteFile().getParentFile();
    defaultKey = getMimeDecoder().decode(asCharSource(new File(keyDir, "default-key.key"), US_ASCII).read().getBytes(US_ASCII));
    hmac222 = getMimeDecoder().decode(asCharSource(new File(keyDir, "222.key"), US_ASCII).read().getBytes(US_ASCII));
    privateKey33 = PemReader.loadPrivateKey(new File(keyDir, "33.privateKey"), Optional.empty());
    server = new TestingPrestoServer(ImmutableMap.<String, String>builder().put("http-server.authentication.type", "JWT").put("http.authentication.jwt.key-file", new File(keyDir, "${KID}.key").toString()).put("http-server.https.enabled", "true").put("http-server.https.keystore.path", getResource("localhost.keystore").getPath()).put("http-server.https.keystore.key", "changeit").build());
    server.installPlugin(new TpchPlugin());
    server.createCatalog(TEST_CATALOG, "tpch");
    waitForNodeRefresh(server);
}
Also used : TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin) TestingPrestoServer(io.prestosql.server.testing.TestingPrestoServer) File(java.io.File) URL(java.net.URL) BeforeClass(org.testng.annotations.BeforeClass)

Example 27 with TpchPlugin

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

the class ElasticsearchQueryRunner method createElasticsearchQueryRunner.

public static DistributedQueryRunner createElasticsearchQueryRunner(EmbeddedElasticsearchNode embeddedElasticsearchNode, Iterable<TpchTable<?>> tables) throws Exception {
    DistributedQueryRunner queryRunner = null;
    try {
        queryRunner = DistributedQueryRunner.builder(createSession()).setNodeCount(NODE_COUNT).build();
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        embeddedElasticsearchNode.start();
        TestingElasticsearchConnectorFactory testFactory = new TestingElasticsearchConnectorFactory();
        installElasticsearchPlugin(queryRunner, testFactory);
        TestingPrestoClient prestoClient = queryRunner.getClient();
        LOG.info("Loading data...");
        long startTime = System.nanoTime();
        for (TpchTable<?> table : tables) {
            loadTpchTopic(embeddedElasticsearchNode, prestoClient, table);
        }
        LOG.info("Loading complete in %s", nanosSince(startTime).toString(SECONDS));
        return queryRunner;
    } catch (Exception e) {
        closeAllSuppress(e, queryRunner, embeddedElasticsearchNode);
        throw e;
    }
}
Also used : TestingPrestoClient(io.prestosql.tests.TestingPrestoClient) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin)

Example 28 with TpchPlugin

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

the class VdmQueryRunner method createVdmQueryRunner.

public static QueryRunner createVdmQueryRunner(String jdbcUrl, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
    DistributedQueryRunner queryRunner = null;
    try {
        File directory = new File("");
        String courseFile = directory.getCanonicalPath();
        System.setProperty("config", courseFile + "/etc/");
        String configDir = System.getProperty("config");
        String hetumetastoreConfig = configDir + "hetu-metastore.properties";
        File file = new File(configDir);
        if (!file.exists()) {
            file.mkdirs();
        }
        File file2 = new File(configDir, "hetu-metastore.properties");
        if (!file2.exists()) {
            try {
                file2.createNewFile();
            } catch (IOException e) {
                LOG.info("Error message: " + e.getStackTrace());
            }
        }
        try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(hetumetastoreConfig))) {
            bufferedWriter.write("hetu.metastore.db.url = " + jdbcUrl);
            bufferedWriter.write("\n");
            bufferedWriter.write("hetu.metastore.type = jdbc\n");
            bufferedWriter.write("hetu.metastore.db.user = user\n");
            bufferedWriter.write("hetu.metastore.db.password = testpass\n");
            bufferedWriter.write("hetu.metastore.cache.ttl = 0s");
        }
        queryRunner = DistributedQueryRunner.builder(createSession()).setNodeCount(1).setExtraProperties(ImmutableMap.of()).setCoordinatorProperties(ImmutableMap.of()).setParserOptions(DEFAULT_SQL_PARSER_OPTIONS).setEnvironment("vdmtest").setBaseDataDir(Optional.empty()).build();
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.installPlugin(new VdmPlugin());
        queryRunner.installPlugin(new HetuMetastorePlugin());
        queryRunner.getCoordinator().loadMetastore();
        queryRunner.createCatalog("tpch", "tpch");
        queryRunner.createCatalog("vdm", "vdm", ImmutableMap.of("vdm.metadata-cache-enabled", "false"));
        return queryRunner;
    } catch (Throwable e) {
        closeAllSuppress(e, queryRunner);
        throw e;
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) HetuMetastorePlugin(io.hetu.core.metastore.HetuMetastorePlugin) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin) FileWriter(java.io.FileWriter) IOException(java.io.IOException) File(java.io.File) BufferedWriter(java.io.BufferedWriter)

Example 29 with TpchPlugin

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

the class MemoryQueryRunner method createQueryRunner.

public static DistributedQueryRunner createQueryRunner(int nodes, Map<String, String> extraProperties, Map<String, String> memoryProperties, Boolean createTpchTables) throws Exception {
    Session session = testSessionBuilder().setCatalog(CATALOG).setSchema("default").build();
    DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, nodes, extraProperties);
    Runtime.getRuntime().addShutdownHook(new Thread(queryRunner::close));
    try {
        queryRunner.installPlugin(new HetuFileSystemClientPlugin());
        queryRunner.installPlugin(new HetuMetastorePlugin());
        TempFolder metastoreFolder = new TempFolder().create();
        Runtime.getRuntime().addShutdownHook(new Thread(metastoreFolder::close));
        Map<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", metastoreFolder.newFolder("metastore").getAbsolutePath());
        queryRunner.getServers().forEach(server -> {
            try {
                server.loadMetastore(new HashMap<>(metastoreConfig));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        });
        queryRunner.installPlugin(new MemoryPlugin());
        queryRunner.getServers().forEach(server -> {
            try {
                TempFolder folder = new TempFolder();
                folder.create();
                Runtime.getRuntime().addShutdownHook(new Thread(folder::close));
                // create memory catalog with custom memory properties
                server.createCatalog(CATALOG, "memory", createConfig(folder, memoryProperties));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        });
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of());
        queryRunner.installPlugin(new TpcdsPlugin());
        queryRunner.createCatalog("tpcds", "tpcds", ImmutableMap.of());
        if (createTpchTables) {
            copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, session, TpchTable.getTables());
        }
        return queryRunner;
    } catch (Exception e) {
        closeAllSuppress(e, queryRunner);
        throw e;
    }
}
Also used : HetuFileSystemClientPlugin(io.hetu.core.filesystem.HetuFileSystemClientPlugin) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) HashMap(java.util.HashMap) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin) IOException(java.io.IOException) HetuMetastorePlugin(io.hetu.core.metastore.HetuMetastorePlugin) TempFolder(io.hetu.core.common.filesystem.TempFolder) TpcdsPlugin(io.prestosql.plugin.tpcds.TpcdsPlugin) Session(io.prestosql.Session)

Example 30 with TpchPlugin

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

the class TestEventListener method setUp.

@BeforeClass
private void setUp() throws Exception {
    session = testSessionBuilder().setSystemProperty("task_concurrency", "1").setCatalog("tpch").setSchema("tiny").setClientInfo("{\"clientVersion\":\"testVersion\"}").build();
    queryRunner = new DistributedQueryRunner(session, 1);
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.installPlugin(new TestingEventListenerPlugin(generatedEvents));
    queryRunner.installPlugin(new ResourceGroupManagerPlugin());
    queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of("tpch.splits-per-node", Integer.toString(SPLITS_PER_NODE)));
    queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_simple.json")));
}
Also used : TestingEventListenerPlugin(io.prestosql.execution.TestEventListenerPlugin.TestingEventListenerPlugin) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

TpchPlugin (io.prestosql.plugin.tpch.TpchPlugin)35 DistributedQueryRunner (io.prestosql.tests.DistributedQueryRunner)22 HashMap (java.util.HashMap)10 BeforeClass (org.testng.annotations.BeforeClass)10 TestingPrestoServer (io.prestosql.server.testing.TestingPrestoServer)8 File (java.io.File)5 HetuMetastorePlugin (io.hetu.core.metastore.HetuMetastorePlugin)4 BlackHolePlugin (io.prestosql.plugin.blackhole.BlackHolePlugin)4 IOException (java.io.IOException)4 BufferedWriter (java.io.BufferedWriter)3 FileWriter (java.io.FileWriter)3 StarTreePlugin (io.hetu.core.cube.startree.StarTreePlugin)2 HetuFileSystemClientPlugin (io.hetu.core.filesystem.HetuFileSystemClientPlugin)2 Session (io.prestosql.Session)2 HiveIdentity (io.prestosql.plugin.hive.authentication.HiveIdentity)2 NoHdfsAuthentication (io.prestosql.plugin.hive.authentication.NoHdfsAuthentication)2 FileHiveMetastore (io.prestosql.plugin.hive.metastore.file.FileHiveMetastore)2 SelectedRole (io.prestosql.spi.security.SelectedRole)2 TestingPrestoClient (io.prestosql.tests.TestingPrestoClient)2 URL (java.net.URL)2