Search in sources :

Example 11 with Trigger

use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.

the class TestTriggersTezSessionPoolManager method testTriggerDefaultRawInputSplits.

@Test(timeout = 60000)
public void testTriggerDefaultRawInputSplits() throws Exception {
    // Map 1 - 55 splits
    // Map 3 - 55 splits
    Expression expression = ExpressionFactory.fromString("RAW_INPUT_SPLITS > 50");
    Trigger trigger = new ExecutionTrigger("highly_parallel", expression, new Action(Action.Type.KILL_QUERY));
    setupTriggers(Lists.newArrayList(trigger));
    String query = "select t1.under_col, t1.value from " + tableName + " t1 join " + tableName + " t2 on t1.under_col>=t2.under_col";
    runQueryWithTrigger(query, getConfigs(), "Query was cancelled");
}
Also used : ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Action(org.apache.hadoop.hive.ql.wm.Action) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger) ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) Expression(org.apache.hadoop.hive.ql.wm.Expression) Test(org.junit.Test)

Example 12 with Trigger

use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.

the class TestTriggersTezSessionPoolManager method testTriggerTotalTasks.

@Test(timeout = 60000)
public void testTriggerTotalTasks() throws Exception {
    Expression expression = ExpressionFactory.fromString("VERTEX_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");
}
Also used : ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Action(org.apache.hadoop.hive.ql.wm.Action) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger) ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) Expression(org.apache.hadoop.hive.ql.wm.Expression) Test(org.junit.Test)

Example 13 with Trigger

use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.

the class TestTriggersTezSessionPoolManager method testTriggerVertexRawInputSplitsNoKill.

@Test(timeout = 60000)
public void testTriggerVertexRawInputSplitsNoKill() throws Exception {
    // Map 1 - 55 splits
    // Map 3 - 55 splits
    Expression expression = ExpressionFactory.fromString("VERTEX_RAW_INPUT_SPLITS > 100");
    Trigger trigger = new ExecutionTrigger("highly_parallel", expression, new Action(Action.Type.KILL_QUERY));
    setupTriggers(Lists.newArrayList(trigger));
    String query = "select t1.under_col, t1.value from " + tableName + " t1 join " + tableName + " t2 on t1.under_col>=t2.under_col";
    runQueryWithTrigger(query, getConfigs(), null);
}
Also used : ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Action(org.apache.hadoop.hive.ql.wm.Action) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger) ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) Expression(org.apache.hadoop.hive.ql.wm.Expression) Test(org.junit.Test)

Example 14 with Trigger

use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.

the class TestTriggersTezSessionPoolManager method testTriggerVertexRawInputSplitsKill.

@Test(timeout = 60000)
public void testTriggerVertexRawInputSplitsKill() throws Exception {
    // Map 1 - 55 splits
    // Map 3 - 55 splits
    Expression expression = ExpressionFactory.fromString("VERTEX_RAW_INPUT_SPLITS > 50");
    Trigger trigger = new ExecutionTrigger("highly_parallel", expression, new Action(Action.Type.KILL_QUERY));
    setupTriggers(Lists.newArrayList(trigger));
    String query = "select t1.under_col, t1.value from " + tableName + " t1 join " + tableName + " t2 on t1.under_col>=t2.under_col";
    runQueryWithTrigger(query, getConfigs(), "Query was cancelled");
}
Also used : ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Action(org.apache.hadoop.hive.ql.wm.Action) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger) ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) Expression(org.apache.hadoop.hive.ql.wm.Expression) Test(org.junit.Test)

Example 15 with Trigger

use of org.apache.hadoop.hive.ql.wm.Trigger in project hive by apache.

the class TestTriggersTezSessionPoolManager method testMultipleTriggers2.

@Test(timeout = 60000)
public void testMultipleTriggers2() throws Exception {
    Expression shuffleExpression = ExpressionFactory.fromString("HDFS_BYTES_READ > 100");
    Trigger shuffleTrigger = new ExecutionTrigger("big_shuffle", shuffleExpression, new Action(Action.Type.KILL_QUERY));
    Expression execTimeExpression = ExpressionFactory.fromString("EXECUTION_TIME > 100000");
    Trigger execTimeTrigger = new ExecutionTrigger("slow_query", execTimeExpression, new Action(Action.Type.KILL_QUERY));
    setupTriggers(Lists.newArrayList(shuffleTrigger, execTimeTrigger));
    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, shuffleTrigger + " violated");
}
Also used : ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Action(org.apache.hadoop.hive.ql.wm.Action) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger) ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) Expression(org.apache.hadoop.hive.ql.wm.Expression) Test(org.junit.Test)

Aggregations

Trigger (org.apache.hadoop.hive.ql.wm.Trigger)37 ExecutionTrigger (org.apache.hadoop.hive.ql.wm.ExecutionTrigger)34 WMTrigger (org.apache.hadoop.hive.metastore.api.WMTrigger)29 Action (org.apache.hadoop.hive.ql.wm.Action)28 Expression (org.apache.hadoop.hive.ql.wm.Expression)28 Test (org.junit.Test)28 WMPoolTrigger (org.apache.hadoop.hive.metastore.api.WMPoolTrigger)8 ArrayList (java.util.ArrayList)7 WMFullResourcePlan (org.apache.hadoop.hive.metastore.api.WMFullResourcePlan)5 HashMap (java.util.HashMap)3 WMPool (org.apache.hadoop.hive.metastore.api.WMPool)3 WMResourcePlan (org.apache.hadoop.hive.metastore.api.WMResourcePlan)3 IdentityHashMap (java.util.IdentityHashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 WorkloadManager (org.apache.hadoop.hive.ql.exec.tez.WorkloadManager)2 LinkedList (java.util.LinkedList)1 List (java.util.List)1 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)1 KillQuery (org.apache.hadoop.hive.ql.session.KillQuery)1