use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.
the class TestTriggersNoTezSessionPool method setupTriggers.
@Override
void setupTriggers(final List<Trigger> triggers) throws Exception {
WMFullResourcePlan rp = new WMFullResourcePlan(new WMResourcePlan("rp"), null);
for (Trigger trigger : triggers) {
WMTrigger wmTrigger = wmTriggerFromTrigger(trigger);
wmTrigger.setIsInUnmanaged(true);
rp.addToTriggers(wmTrigger);
}
TezSessionPoolManager.getInstance().updateTriggers(rp);
}
use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.
the class TestTriggersNoTezSessionPool method testTriggerDAGTotalTasks.
@Test(timeout = 60000)
public void testTriggerDAGTotalTasks() throws Exception {
Expression expression = ExpressionFactory.fromString("DAG_TOTAL_TASKS > 50");
Trigger trigger = new ExecutionTrigger("highly_parallel", expression, new Action(Action.Type.KILL_QUERY));
setupTriggers(Lists.newArrayList(trigger));
String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName + " t2 on t1.under_col>=t2.under_col";
runQueryWithTrigger(query, getConfigs(), trigger + " violated");
}
use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.
the class TestTriggersNoTezSessionPool method testTriggerSlowQueryExecutionTime.
@Test(timeout = 60000)
public void testTriggerSlowQueryExecutionTime() throws Exception {
Expression expression = ExpressionFactory.fromString("EXECUTION_TIME > 1000");
Trigger trigger = new ExecutionTrigger("slow_query", expression, new Action(Action.Type.KILL_QUERY));
setupTriggers(Lists.newArrayList(trigger));
String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName + " t2 on t1.under_col>=t2.under_col";
runQueryWithTrigger(query, null, trigger + " violated");
}
use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.
the class TestTriggersTezSessionPoolManager method testTriggerSlowQueryExecutionTime.
@Test(timeout = 60000)
public void testTriggerSlowQueryExecutionTime() throws Exception {
Expression expression = ExpressionFactory.fromString("EXECUTION_TIME > 1000");
Trigger trigger = new ExecutionTrigger("slow_query", expression, new Action(Action.Type.KILL_QUERY));
setupTriggers(Lists.newArrayList(trigger));
String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName + " t2 on t1.under_col>=t2.under_col";
runQueryWithTrigger(query, null, trigger + " violated");
}
use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.
the class TestTriggersTezSessionPoolManager method testTriggerHighShuffleBytes.
@Test(timeout = 60000)
public void testTriggerHighShuffleBytes() throws Exception {
Expression expression = ExpressionFactory.fromString("SHUFFLE_BYTES > 100");
Trigger trigger = new ExecutionTrigger("big_shuffle", expression, new Action(Action.Type.KILL_QUERY));
setupTriggers(Lists.newArrayList(trigger));
List<String> cmds = new ArrayList<>();
cmds.add("set hive.auto.convert.join=false");
// to slow down the reducer so that SHUFFLE_BYTES publishing and validation can happen, adding sleep between
// multiple reduce stages
String query = "select count(distinct t.under_col), sleep(t.under_col, 10) from (select t1.under_col from " + tableName + " t1 " + "join " + tableName + " t2 on t1.under_col=t2.under_col order by sleep(t1.under_col, 0))" + " t group by t.under_col";
runQueryWithTrigger(query, cmds, trigger + " violated");
}
Aggregations