Search in sources :

Example 26 with Expression

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

the class TestTriggersTezSessionPoolManager method testTriggerCustomNonExistent.

@Test(timeout = 60000)
public void testTriggerCustomNonExistent() throws Exception {
    Expression expression = ExpressionFactory.fromString("OPEN_FILES > 50");
    Trigger trigger = new ExecutionTrigger("non_existent", expression, new Action(Action.Type.KILL_QUERY));
    setupTriggers(Lists.newArrayList(trigger));
    String query = "select l.under_col, l.value from " + tableName + " l join " + tableName + " r on l.under_col>=r.under_col";
    runQueryWithTrigger(query, null, 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 27 with Expression

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

the class TestTriggersTezSessionPoolManager method testTriggerHighBytesWrite.

@Test(timeout = 60000)
public void testTriggerHighBytesWrite() throws Exception {
    Expression expression = ExpressionFactory.fromString("FILE_BYTES_WRITTEN > 100");
    Trigger trigger = new ExecutionTrigger("big_write", 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");
}
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 28 with Expression

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

the class TestTriggersTezSessionPoolManager method testTriggerCustomCreatedFiles.

@Test(timeout = 120000)
public void testTriggerCustomCreatedFiles() throws Exception {
    List<String> cmds = getConfigs();
    Expression expression = ExpressionFactory.fromString("CREATED_FILES > 5");
    Trigger trigger = new ExecutionTrigger("high_read_ops", expression, new Action(Action.Type.KILL_QUERY));
    setupTriggers(Lists.newArrayList(trigger));
    String query = "create table testtab2 as select * from " + tableName;
    runQueryWithTrigger(query, cmds, trigger + " violated");
    // partitioned insert
    expression = ExpressionFactory.fromString("CREATED_FILES > 10");
    trigger = new ExecutionTrigger("high_read_ops", expression, new Action(Action.Type.KILL_QUERY));
    setupTriggers(Lists.newArrayList(trigger));
    cmds.add("drop table src3");
    cmds.add("create table src3 (key int) partitioned by (value string)");
    query = "insert overwrite table src3 partition (value) select sleep(under_col, 10), value from " + tableName + " where under_col < 100";
    runQueryWithTrigger(query, cmds, 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)

Aggregations

Action (org.apache.hadoop.hive.ql.wm.Action)28 ExecutionTrigger (org.apache.hadoop.hive.ql.wm.ExecutionTrigger)28 Expression (org.apache.hadoop.hive.ql.wm.Expression)28 Trigger (org.apache.hadoop.hive.ql.wm.Trigger)28 Test (org.junit.Test)28 WMTrigger (org.apache.hadoop.hive.metastore.api.WMTrigger)24 ArrayList (java.util.ArrayList)5 WMPoolTrigger (org.apache.hadoop.hive.metastore.api.WMPoolTrigger)4