use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.
the class HiveQueryRunner method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Iterable<TpchTable<?>> tables, Map<String, String> extraProperties, String security, Map<String, String> extraHiveProperties) throws Exception {
assertEquals(DateTimeZone.getDefault(), TIME_ZONE, "Timezone not configured correctly. Add -Duser.timezone=Asia/Katmandu to your JVM arguments");
DistributedQueryRunner queryRunner = new DistributedQueryRunner(createSession(), 4, extraProperties);
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
File baseDir = queryRunner.getCoordinator().getBaseDataDir().resolve("hive_data").toFile();
HiveClientConfig hiveClientConfig = new HiveClientConfig();
HiveS3Config s3Config = new HiveS3Config();
HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationUpdater(hiveClientConfig, s3Config));
HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hiveClientConfig, new NoHdfsAuthentication());
FileHiveMetastore metastore = new FileHiveMetastore(hdfsEnvironment, baseDir.toURI().toString(), "test");
metastore.createDatabase(createDatabaseMetastoreObject(TPCH_SCHEMA));
metastore.createDatabase(createDatabaseMetastoreObject(TPCH_BUCKETED_SCHEMA));
queryRunner.installPlugin(new HivePlugin(HIVE_CATALOG, metastore));
Map<String, String> hiveProperties = ImmutableMap.<String, String>builder().putAll(extraHiveProperties).put("hive.metastore.uri", "thrift://localhost:8080").put("hive.time-zone", TIME_ZONE.getID()).put("hive.security", security).build();
Map<String, String> hiveBucketedProperties = ImmutableMap.<String, String>builder().putAll(hiveProperties).put("hive.max-initial-split-size", // so that each bucket has multiple splits
"10kB").put("hive.max-split-size", // so that each bucket has multiple splits
"10kB").put("hive.storage-format", // so that there's no minimum split size for the file
"TEXTFILE").put("hive.compression-codec", // so that the file is splittable
"NONE").build();
queryRunner.createCatalog(HIVE_CATALOG, HIVE_CATALOG, hiveProperties);
queryRunner.createCatalog(HIVE_BUCKETED_CATALOG, HIVE_CATALOG, hiveBucketedProperties);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
copyTpchTablesBucketed(queryRunner, "tpch", TINY_SCHEMA_NAME, createBucketedSession(), tables);
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.
the class MySqlQueryRunner method createMySqlQueryRunner.
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;
}
}
use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.
the class BlackHoleQueryRunner method createQueryRunner.
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;
}
}
use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.
the class CassandraQueryRunner method createCassandraQueryRunner.
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.flush("tpch", table.getTableName());
}
EmbeddedCassandra.refreshSizeEstimates();
tpchLoaded = true;
}
return queryRunner;
}
use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.
the class JdbcQueryRunner method createJdbcQueryRunner.
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;
}
}
Aggregations