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);
}
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;
}
}
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;
}
}
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;
}
}
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")));
}
Aggregations