public static LocalQueryRunner createQueryRunner(Map<String, String> catalogProperties, Class<? extends AtopFactory> factoryClass) { Session session = testSessionBuilder() .setCatalog("atop") .setSchema("default") .setTimeZoneKey(TimeZoneKey.getTimeZoneKey(TimeZone.getDefault().getID())) .build(); LocalQueryRunner queryRunner = new LocalQueryRunner(session); try { AtopConnectorFactory connectorFactory = new AtopConnectorFactory(factoryClass, LocalAtopQueryRunner.class.getClassLoader()); ImmutableMap.Builder<String, String> properties = ImmutableMap.<String, String>builder() .putAll(catalogProperties) .put("atop.max-history-days", "1"); queryRunner.createCatalog("atop", connectorFactory, properties.build()); return queryRunner; } catch (Exception e) { closeAllSuppress(e, queryRunner); throw e; } } }
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") public static DistributedQueryRunner createJmxQueryRunner() throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new JmxPlugin()); queryRunner.createCatalog("jmx", "jmx"); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }
public static QueryRunner createMySqlQueryRunner(TestingMySqlServer server, Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("connection-url", server.getJdbcUrl()) .put("allow-drop-table", "true") .build(); queryRunner.installPlugin(new MySqlPlugin()); queryRunner.createCatalog("mysql", "mysql", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner, server); throw e; } }
public static QueryRunner createKuduQueryRunner(String schema) throws Exception { QueryRunner runner = null; String kuduSchema = isSchemaEmulationEnabled() ? schema : "default"; try { runner = DistributedQueryRunner.builder(createSession(kuduSchema)).setNodeCount(3).build(); installKuduConnector(runner, kuduSchema); return runner; } catch (Throwable e) { closeAllSuppress(e, runner); throw e; } }
public static QueryRunner createPostgreSqlQueryRunner(TestingPostgreSqlServer server, Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("connection-url", server.getJdbcUrl()) .put("allow-drop-table", "true") .build(); createSchema(server.getJdbcUrl(), "tpch"); queryRunner.installPlugin(new PostgreSqlPlugin()); queryRunner.createCatalog("postgresql", "postgresql", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner, server); throw e; } }
public static MongoQueryRunner createMongoQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { MongoQueryRunner queryRunner = null; try { queryRunner = new MongoQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = ImmutableMap.of( "mongodb.seeds", queryRunner.getAddress().getHostString() + ":" + queryRunner.getAddress().getPort(), "mongodb.socket-keep-alive", "true"); queryRunner.installPlugin(new MongoPlugin()); queryRunner.createCatalog("mongodb", "mongodb", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception { Session session = testSessionBuilder() .setCatalog("blackhole") .setSchema("default") .build(); DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 4, extraProperties); try { queryRunner.installPlugin(new BlackHolePlugin()); queryRunner.createCatalog("blackhole", "blackhole", ImmutableMap.of()); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of()); return queryRunner; } catch (Exception e) { closeAllSuppress(e, queryRunner); throw e; } }
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception { Session session = testSessionBuilder() .setCatalog(CATALOG) .setSchema("default") .build(); DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 4, extraProperties); try { queryRunner.installPlugin(new MemoryPlugin()); queryRunner.createCatalog(CATALOG, "memory", ImmutableMap.of()); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of()); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, session, TpchTable.getTables()); return queryRunner; } catch (Exception e) { closeAllSuppress(e, queryRunner); throw e; } }
public static QueryRunner createKuduQueryRunnerTpch(Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner runner = null; String kuduSchema = isSchemaEmulationEnabled() ? "tpch" : "default"; try { runner = DistributedQueryRunner.builder(createSession(kuduSchema)).setNodeCount(3).build(); runner.installPlugin(new TpchPlugin()); runner.createCatalog("tpch", "tpch"); installKuduConnector(runner, kuduSchema); copyTpchTables(runner, "tpch", TINY_SCHEMA_NAME, createSession(kuduSchema), tables); return runner; } catch (Throwable e) { closeAllSuppress(e, runner); throw e; } }
public static DistributedQueryRunner createRedisQueryRunner(EmbeddedRedis embeddedRedis, String dataFormat, Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 2); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); embeddedRedis.start(); Map<SchemaTableName, RedisTableDescription> tableDescriptions = createTpchTableDescriptions(queryRunner.getCoordinator().getMetadata(), tables, dataFormat); installRedisPlugin(embeddedRedis, queryRunner, tableDescriptions); TestingPrestoClient prestoClient = queryRunner.getClient(); log.info("Loading data..."); long startTime = System.nanoTime(); for (TpchTable<?> table : tables) { loadTpchTable(embeddedRedis, prestoClient, table, dataFormat); } log.info("Loading complete in %s", nanosSince(startTime).toString(SECONDS)); embeddedRedis.destroyJedisPool(); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner, embeddedRedis); throw e; } }
public static DistributedQueryRunner createJdbcQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = TestingH2JdbcModule.createProperties(); createSchema(properties, "tpch"); queryRunner.installPlugin(new JdbcPlugin("base-jdbc", new TestingH2JdbcModule())); queryRunner.createCatalog("jdbc", "base-jdbc", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }
public static DistributedQueryRunner createKafkaQueryRunner(EmbeddedKafka embeddedKafka, Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 2); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); embeddedKafka.start(); for (TpchTable<?> table : tables) { embeddedKafka.createTopics(kafkaTopicName(table)); } Map<SchemaTableName, KafkaTopicDescription> topicDescriptions = createTpchTopicDescriptions(queryRunner.getCoordinator().getMetadata(), tables); installKafkaPlugin(embeddedKafka, queryRunner, topicDescriptions); TestingPrestoClient prestoClient = queryRunner.getClient(); log.info("Loading data..."); long startTime = System.nanoTime(); for (TpchTable<?> table : tables) { loadTpchTopic(embeddedKafka, prestoClient, table); } log.info("Loading complete in %s", nanosSince(startTime).toString(SECONDS)); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner, embeddedKafka); throw e; } }
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(); ElasticsearchTableDescriptionProvider tableDescriptions = createTableDescriptions(queryRunner.getCoordinator().getMetadata()); TestingElasticsearchConnectorFactory testFactory = new TestingElasticsearchConnectorFactory(tableDescriptions); 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; } }
public static QueryRunner createMySqlQueryRunner(TestingMySqlServer server, Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("connection-url", server.getJdbcUrl()) .put("allow-drop-table", "true") .build(); queryRunner.installPlugin(new MySqlPlugin()); queryRunner.createCatalog("mysql", "mysql", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner, server); throw e; } }
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") public static DistributedQueryRunner createJmxQueryRunner() throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new JmxPlugin()); queryRunner.createCatalog("jmx", "jmx"); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }
public static QueryRunner createKuduQueryRunner(String schema) throws Exception { QueryRunner runner = null; String kuduSchema = isSchemaEmulationEnabled() ? schema : "default"; try { runner = DistributedQueryRunner.builder(createSession(kuduSchema)).setNodeCount(3).build(); installKuduConnector(runner, kuduSchema); return runner; } catch (Throwable e) { closeAllSuppress(e, runner); throw e; } }
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception { Session session = testSessionBuilder() .setCatalog("blackhole") .setSchema("default") .build(); DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 4, extraProperties); try { queryRunner.installPlugin(new BlackHolePlugin()); queryRunner.createCatalog("blackhole", "blackhole", ImmutableMap.of()); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of()); return queryRunner; } catch (Exception e) { closeAllSuppress(e, queryRunner); throw e; } }
public static QueryRunner createKuduQueryRunnerTpch(Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner runner = null; String kuduSchema = isSchemaEmulationEnabled() ? "tpch" : "default"; try { runner = DistributedQueryRunner.builder(createSession(kuduSchema)).setNodeCount(3).build(); runner.installPlugin(new TpchPlugin()); runner.createCatalog("tpch", "tpch"); installKuduConnector(runner, kuduSchema); copyTpchTables(runner, "tpch", TINY_SCHEMA_NAME, createSession(kuduSchema), tables); return runner; } catch (Throwable e) { closeAllSuppress(e, runner); throw e; } }
public static DistributedQueryRunner createJdbcQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = TestingH2JdbcModule.createProperties(); createSchema(properties, "tpch"); queryRunner.installPlugin(new JdbcPlugin("base-jdbc", new TestingH2JdbcModule())); queryRunner.createCatalog("jdbc", "base-jdbc", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }
public static DistributedQueryRunner createJdbcQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = new DistributedQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = TestingH2JdbcModule.createProperties(); createSchema(properties, "tpch"); queryRunner.installPlugin(new JdbcPlugin("base-jdbc", new TestingH2JdbcModule())); queryRunner.createCatalog("jdbc", "base-jdbc", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }