Search in sources :

Example 1 with MiniDruidCluster

use of org.apache.hive.druid.MiniDruidCluster in project hive by apache.

the class QTestUtil method setupMiniCluster.

private void setupMiniCluster(HadoopShims shims, String confDir) throws IOException {
    String uriString = fs.getUri().toString();
    if (clusterType == MiniClusterType.druid) {
        final String tempDir = System.getProperty("test.tmp.dir");
        druidCluster = new MiniDruidCluster("mini-druid", getLogDirectory(), tempDir, setup.zkPort, Utilities.jarFinderGetJar(MiniDruidCluster.class));
        final Path druidDeepStorage = fs.makeQualified(new Path(druidCluster.getDeepStorageDir()));
        fs.mkdirs(druidDeepStorage);
        conf.set("hive.druid.storage.storageDirectory", druidDeepStorage.toUri().getPath());
        conf.set("hive.druid.metadata.db.type", "derby");
        conf.set("hive.druid.metadata.uri", druidCluster.getMetadataURI());
        final Path scratchDir = fs.makeQualified(new Path(System.getProperty("test.tmp.dir"), "druidStagingDir"));
        fs.mkdirs(scratchDir);
        conf.set("hive.druid.working.directory", scratchDir.toUri().getPath());
        druidCluster.init(conf);
        druidCluster.start();
    }
    if (clusterType.getCoreClusterType() == CoreClusterType.TEZ) {
        if (confDir != null && !confDir.isEmpty()) {
            conf.addResource(new URL("file://" + new File(confDir).toURI().getPath() + "/tez-site.xml"));
        }
        int numTrackers = 2;
        if (EnumSet.of(MiniClusterType.llap, MiniClusterType.llap_local).contains(clusterType)) {
            llapCluster = LlapItUtils.startAndGetMiniLlapCluster(conf, setup.zooKeeperCluster, confDir);
        } else {
        }
        if (EnumSet.of(MiniClusterType.llap_local, MiniClusterType.tez_local).contains(clusterType)) {
            mr = shims.getLocalMiniTezCluster(conf, clusterType == MiniClusterType.llap_local);
        } else {
            mr = shims.getMiniTezCluster(conf, numTrackers, uriString, EnumSet.of(MiniClusterType.llap, MiniClusterType.llap_local).contains(clusterType));
        }
    } else if (clusterType == MiniClusterType.miniSparkOnYarn) {
        mr = shims.getMiniSparkCluster(conf, 2, uriString, 1);
    } else if (clusterType == MiniClusterType.mr) {
        mr = shims.getMiniMrCluster(conf, 2, uriString, 1);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) MiniDruidCluster(org.apache.hive.druid.MiniDruidCluster) File(java.io.File) URL(java.net.URL)

Aggregations

File (java.io.File)1 URL (java.net.URL)1 Path (org.apache.hadoop.fs.Path)1 MiniDruidCluster (org.apache.hive.druid.MiniDruidCluster)1