use of io.prestosql.plugin.hive.HivePlugin in project hetu-core by openlookeng.
the class HetuTestServer method addHiveCatalogToQueryRunner.
public void addHiveCatalogToQueryRunner(Map<String, String> hiveProperties) {
queryRunner.installPlugin(new HivePlugin("hive"));
queryRunner.createCatalog("hive", "hive", hiveProperties);
}
use of io.prestosql.plugin.hive.HivePlugin in project hetu-core by openlookeng.
the class HindexQueryRunner method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties, Map<String, String> metastoreProperties, Map<String, String> coordinatorProperties) throws Exception {
Session session = testSessionBuilder().setSource("test").setCatalog("hive").setSchema("test").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).setExtraProperties(extraProperties).setCoordinatorProperties(coordinatorProperties).build();
try {
File tempDir = Files.createTempDirectory("test-hive").toFile();
File hiveDir = new File(tempDir, "hive_data");
HiveMetastore metastore = createTestingFileHiveMetastore(hiveDir);
HiveIdentity identity = new HiveIdentity(SESSION);
metastore.createDatabase(identity, Database.builder().setDatabaseName("test").setOwnerName("public").setOwnerType(PrincipalType.ROLE).build());
queryRunner.installPlugin(new HetuFileSystemClientPlugin());
queryRunner.installPlugin(new HetuMetastorePlugin());
queryRunner.installPlugin(new HiveHadoop2Plugin());
queryRunner.installPlugin(new HeuristicIndexPlugin());
queryRunner.installPlugin(new HivePlugin("Hive", Optional.of(metastore)));
queryRunner.getServers().forEach(server -> {
try {
server.loadMetastore(metastoreProperties);
server.getHeuristicIndexerManager().buildIndexClient();
server.getHeuristicIndexerManager().initCache();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
Map<String, String> hiveProperties = ImmutableMap.<String, String>builder().put("hive.allow-drop-table", "true").build();
queryRunner.createCatalog("hive", "Hive", hiveProperties);
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of io.prestosql.plugin.hive.HivePlugin in project hetu-core by openlookeng.
the class TestSpatialJoins method createQueryRunner.
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();
HiveConfig hiveConfig = new HiveConfig();
HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hiveConfig), ImmutableSet.of());
HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hiveConfig, new NoHdfsAuthentication());
FileHiveMetastore metastore = new FileHiveMetastore(hdfsEnvironment, baseDir.toURI().toString(), "test");
metastore.createDatabase(new HiveIdentity(SESSION), Database.builder().setDatabaseName("default").setOwnerName("public").setOwnerType(PrincipalType.ROLE).build());
queryRunner.installPlugin(new HivePlugin("hive", Optional.of(metastore)));
queryRunner.createCatalog("hive", "hive");
return queryRunner;
}
Aggregations