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);
}
}
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);
}
}
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>());
}
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);
}
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 = "";
}
Aggregations