Search in sources :

Example 1 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestMiniHS2StateWithNoZookeeper method beforeTest.

@BeforeClass
public static void beforeTest() throws Exception {
    hiveConf = new HiveConf();
    hiveConf.setBoolVar(ConfVars.HIVE_SERVER2_SUPPORT_DYNAMIC_SERVICE_DISCOVERY, true);
    hiveConf.setIntVar(ConfVars.HIVE_ZOOKEEPER_CONNECTION_MAX_RETRIES, 0);
    hiveConf.setTimeVar(ConfVars.HIVE_ZOOKEEPER_CONNECTION_BASESLEEPTIME, 0, TimeUnit.MILLISECONDS);
    miniHS2 = new MiniHS2(hiveConf);
    Map<String, String> confOverlay = new HashMap<String, String>();
    try {
        miniHS2.start(confOverlay);
    } catch (Exception ex) {
        LOG.warn("Zookeeper is not set up intentionally, so the error is expected (unless it's not related to ZK): " + ex);
        miniHS2.setStarted(true);
    }
}
Also used : HashMap(java.util.HashMap) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 2 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class StartMiniHS2Cluster method testRunCluster.

/**
   * Not a unit test - this simply runs a MiniHS2 cluster, which can be used for manual testing.
   */
@Test
public void testRunCluster() throws Exception {
    if (!Boolean.parseBoolean(System.getProperty("miniHS2.run", "false"))) {
        return;
    }
    MiniClusterType clusterType = MiniClusterType.valueOf(System.getProperty("miniHS2.clusterType", "MR").toUpperCase());
    String confFilesProperty = System.getProperty("miniHS2.conf", "../../data/conf/hive-site.xml");
    boolean usePortsFromConf = Boolean.parseBoolean(System.getProperty("miniHS2.usePortsFromConf", "false"));
    // Load conf files
    String[] confFiles = confFilesProperty.split(",");
    int idx;
    for (idx = 0; idx < confFiles.length; ++idx) {
        String confFile = confFiles[idx];
        if (confFile.isEmpty()) {
            continue;
        }
        HiveConf.setHiveSiteLocation(new URL("file://" + new File(confFile).toURI().getPath()));
        break;
    }
    HiveConf conf = new HiveConf();
    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    conf.setBoolVar(HiveConf.ConfVars.HIVE_RPC_QUERY_PLAN, true);
    for (; idx < confFiles.length; ++idx) {
        String confFile = confFiles[idx];
        if (confFile.isEmpty()) {
            continue;
        }
        conf.addResource(new URL("file://" + new File(confFile).toURI().getPath()));
    }
    miniHS2 = new MiniHS2(conf, clusterType, usePortsFromConf);
    Map<String, String> confOverlay = new HashMap<String, String>();
    miniHS2.start(confOverlay);
    miniHS2.getDFS().getFileSystem().mkdirs(new Path("/apps_staging_dir/anonymous"));
    System.out.println("JDBC URL avaailable at " + miniHS2.getJdbcURL());
    // MiniHS2 cluster is up .. let it run until someone kills the test
    while (true) {
        Thread.sleep(1000);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) MiniClusterType(org.apache.hive.jdbc.miniHS2.MiniHS2.MiniClusterType) HashMap(java.util.HashMap) HiveConf(org.apache.hadoop.hive.conf.HiveConf) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 3 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestHS2ImpersonationWithRemoteMS method startServices.

@BeforeClass
public static void startServices() throws Exception {
    HiveConf hiveConf = new HiveConf();
    hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_MIN_WORKER_THREADS, 1);
    hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_MAX_WORKER_THREADS, 1);
    hiveConf.setBoolVar(ConfVars.METASTORE_EXECUTE_SET_UGI, true);
    hiveConf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    miniHS2 = new MiniHS2.Builder().withMiniMR().withRemoteMetastore().withConf(hiveConf).build();
    miniHS2.start(new HashMap<String, String>());
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 4 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestOperationLoggingAPIWithTez method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    tableName = "testOperationLoggingAPIWithTez_table";
    expectedLogsVerbose = new String[] { "Starting Semantic Analysis" };
    expectedLogsExecution = new String[] { "Compiling command", "Completed compiling command", "Executing command", "Completed executing command", "Semantic Analysis Completed", "Executing on YARN cluster with App id", "Setting Tez DAG access" };
    expectedLogsPerformance = new String[] { "<PERFLOG method=compile from=org.apache.hadoop.hive.ql.Driver>", "<PERFLOG method=parse from=org.apache.hadoop.hive.ql.Driver>", "<PERFLOG method=Driver.run from=org.apache.hadoop.hive.ql.Driver>", "from=org.apache.hadoop.hive.ql.exec.tez.monitoring.TezJobMonitor", "org.apache.tez.common.counters.DAGCounter", "NUM_SUCCEEDED_TASKS", "TOTAL_LAUNCHED_TASKS", "CPU_MILLISECONDS" };
    hiveConf = new HiveConf();
    hiveConf.set(ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL.varname, "verbose");
    // Set tez execution summary to false.
    hiveConf.setBoolVar(ConfVars.TEZ_EXEC_SUMMARY, false);
    miniHS2 = new MiniHS2(hiveConf, MiniClusterType.TEZ);
    confOverlay = new HashMap<String, String>();
    confOverlay.put(ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    miniHS2.start(confOverlay);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 5 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestSchedulerQueue method setUp.

@Before
public void setUp() throws Exception {
    DriverManager.setLoginTimeout(0);
    miniHS2 = new MiniHS2(conf, MiniClusterType.MR);
    miniHS2.setConfProperty(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, "false");
    miniHS2.setConfProperty(HiveConf.ConfVars.HIVE_SERVER2_MAP_FAIR_SCHEDULER_QUEUE.varname, "true");
    miniHS2.setConfProperty(YarnConfiguration.RM_SCHEDULER, "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler");
    miniHS2.start(new HashMap<String, String>());
    HiveTestSimpleGroupMapping.primaryTag = "";
}
Also used : MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) Before(org.junit.Before)

Aggregations

MiniHS2 (org.apache.hive.jdbc.miniHS2.MiniHS2)19 BeforeClass (org.junit.BeforeClass)16 HiveConf (org.apache.hadoop.hive.conf.HiveConf)15 HashMap (java.util.HashMap)8 Path (org.apache.hadoop.fs.Path)6 SessionStateUserAuthenticator (org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator)5 File (java.io.File)2 URL (java.net.URL)2 Statement (java.sql.Statement)2 SQLStdHiveAuthorizerFactory (org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory)2 Test (org.junit.Test)2 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 MiniClusterType (org.apache.hive.jdbc.miniHS2.MiniHS2.MiniClusterType)1 Before (org.junit.Before)1