public void createCatalog(String catalogName, String connectorName) { createCatalog(catalogName, connectorName, ImmutableMap.of()); }
@Override public void createCatalog(String catalogName, String connectorName, Map<String, String> properties) { source.createCatalog(catalogName, connectorName, properties); }
@Override public DistributedQueryRunner build() throws Exception { DistributedQueryRunner queryRunner = buildWithoutCatalogs(); try { queryRunner.createCatalog("tpch", "tpch"); return queryRunner; } catch (Exception e) { queryRunner.close(); throw e; } }
@BeforeClass public void setup() throws Exception { DistributedQueryRunner runner = TpchQueryRunnerBuilder.builder() // We are not able to calculate stats for PARTIAL aggregations .amendSession(builder -> builder.setSystemProperty(PREFER_PARTIAL_AGGREGATION, "false")) .buildWithoutCatalogs(); runner.createCatalog( "tpch", "tpch", ImmutableMap.of(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name())); statisticsAssertion = new StatisticsAssertion(runner); }
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 DistributedQueryRunner createQueryRunner(Session session, Map<String, String> properties) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 2, properties); try { queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); return queryRunner; } catch (Exception e) { queryRunner.close(); 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 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 synchronized DistributedQueryRunner createAccumuloQueryRunner(Map<String, String> extraProperties) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(createSession(), 4, extraProperties); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); queryRunner.installPlugin(new AccumuloPlugin()); Map<String, String> accumuloProperties = ImmutableMap.<String, String>builder() .put(AccumuloConfig.INSTANCE, connector.getInstance().getInstanceName()) .put(AccumuloConfig.ZOOKEEPERS, connector.getInstance().getZooKeepers()) .put(AccumuloConfig.USERNAME, MAC_USER) .put(AccumuloConfig.PASSWORD, MAC_PASSWORD) .put(AccumuloConfig.ZOOKEEPER_METADATA_ROOT, "/presto-accumulo-test") .build(); queryRunner.createCatalog("accumulo", "accumulo", accumuloProperties); if (!tpchLoaded) { copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), TpchTable.getTables()); connector.tableOperations().addSplits("tpch.orders", ImmutableSortedSet.of(new Text(new LexicoderRowSerializer().encode(BIGINT, 7500L)))); tpchLoaded = true; } return queryRunner; }
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; } }
@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; } }
@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"))); }
private static DistributedQueryRunner createQueryRunner() throws Exception { Session session = testSessionBuilder() .setCatalog("tpch_indexed") .setSchema(TINY_SCHEMA_NAME) .build(); DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 3); queryRunner.installPlugin(new IndexedTpchPlugin(INDEX_SPEC)); queryRunner.createCatalog("tpch_indexed", "tpch_indexed"); return queryRunner; } }
public static DistributedQueryRunner createQueryRunner(Session session) throws Exception { DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session) .setNodeCount(2) .build(); try { queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); return queryRunner; } catch (Exception e) { queryRunner.close(); throw e; } } }
public static synchronized DistributedQueryRunner createCassandraQueryRunner() throws Exception { EmbeddedCassandra.start(); DistributedQueryRunner queryRunner = new DistributedQueryRunner(createCassandraSession("tpch"), 4); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); queryRunner.installPlugin(new CassandraPlugin()); queryRunner.createCatalog("cassandra", "cassandra", ImmutableMap.of( "cassandra.contact-points", EmbeddedCassandra.getHost(), "cassandra.native-protocol-port", Integer.toString(EmbeddedCassandra.getPort()), "cassandra.allow-drop-table", "true")); if (!tpchLoaded) { createKeyspace(EmbeddedCassandra.getSession(), "tpch"); List<TpchTable<?>> tables = TpchTable.getTables(); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createCassandraSession("tpch"), tables); for (TpchTable table : tables) { EmbeddedCassandra.refreshSizeEstimates("tpch", table.getTableName()); } tpchLoaded = true; } return queryRunner; }
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 createQueryRunner() throws Exception { DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(testSessionBuilder().build()) .setNodeCount(2) .build(); try { queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); return queryRunner; } catch (Exception e) { queryRunner.close(); throw e; } } }
private static DistributedQueryRunner createQueryRunner() throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder() .setSource(TestSpatialJoins.class.getSimpleName()) .setCatalog("hive") .setSchema("default") .build(), 4); queryRunner.installPlugin(new GeoPlugin()); File baseDir = queryRunner.getCoordinator().getBaseDataDir().resolve("hive_data").toFile(); HiveClientConfig hiveClientConfig = new HiveClientConfig(); HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationUpdater(hiveClientConfig)); HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hiveClientConfig, new NoHdfsAuthentication()); FileHiveMetastore metastore = new FileHiveMetastore(hdfsEnvironment, baseDir.toURI().toString(), "test"); metastore.createDatabase(Database.builder() .setDatabaseName("default") .setOwnerName("public") .setOwnerType(PrincipalType.ROLE) .build()); queryRunner.installPlugin(new HivePlugin("hive", Optional.of(metastore))); queryRunner.createCatalog("hive", "hive"); return queryRunner; }
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 createQueryRunner(Map<String, String> extraProperties, Map<String, String> coordinatorProperties) throws Exception { Session session = testSessionBuilder() .setSource("test") .setCatalog("tpcds") .setSchema("sf1") .build(); DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session) .setNodeCount(4) .setExtraProperties(extraProperties) .setCoordinatorProperties(coordinatorProperties) .build(); try { queryRunner.installPlugin(new TpcdsPlugin()); queryRunner.createCatalog("tpcds", "tpcds"); return queryRunner; } catch (Exception e) { queryRunner.close(); throw e; } }