Search in sources :

Example 1 with LineageInfo

use of org.apache.hadoop.hive.ql.tools.LineageInfo in project hive by apache.

the class TestLineageInfo method testSimpleQuery4.

@Test
public void testSimpleQuery4() {
    LineageInfo lep = new LineageInfo();
    try {
        lep.getLineageInfo("FROM ( FROM ( FROM src1 src1 SELECT src1.key AS c1, src1.value AS c2 WHERE src1.key > 10 and src1.key < 20) a RIGHT OUTER JOIN ( FROM src2 src2 SELECT src2.key AS c3, src2.value AS c4 WHERE src2.key > 15 and src2.key < 25) b ON (a.c1 = b.c3) SELECT a.c1 AS c1, a.c2 AS c2, b.c3 AS c3, b.c4 AS c4) c SELECT c.c1, c.c2, c.c3, c.c4", ctx);
        TreeSet<String> i = new TreeSet<String>();
        TreeSet<String> o = new TreeSet<String>();
        i.add("src1");
        i.add("src2");
        checkOutput(lep, i, o);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed");
    }
}
Also used : TreeSet(java.util.TreeSet) LineageInfo(org.apache.hadoop.hive.ql.tools.LineageInfo) Test(org.junit.Test)

Example 2 with LineageInfo

use of org.apache.hadoop.hive.ql.tools.LineageInfo in project hive by apache.

the class TestLineageInfo method testSimpleQuery.

@Test
public void testSimpleQuery() {
    LineageInfo lep = new LineageInfo();
    try {
        lep.getLineageInfo("INSERT OVERWRITE TABLE dest1 partition (ds = '111')  " + "SELECT s.* FROM srcpart TABLESAMPLE (BUCKET 1 OUT OF 1) s " + "WHERE s.ds='2008-04-08' and s.hr='11'", ctx);
        TreeSet<String> i = new TreeSet<String>();
        TreeSet<String> o = new TreeSet<String>();
        i.add("srcpart");
        o.add("dest1");
        checkOutput(lep, i, o);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed");
    }
}
Also used : TreeSet(java.util.TreeSet) LineageInfo(org.apache.hadoop.hive.ql.tools.LineageInfo) Test(org.junit.Test)

Example 3 with LineageInfo

use of org.apache.hadoop.hive.ql.tools.LineageInfo in project hive by apache.

the class TestLineageInfo method testSimpleQuery5.

@Test
public void testSimpleQuery5() {
    LineageInfo lep = new LineageInfo();
    try {
        lep.getLineageInfo("insert overwrite table x select a.y, b.y " + "from a a full outer join b b on (a.x = b.y)", ctx);
        TreeSet<String> i = new TreeSet<String>();
        TreeSet<String> o = new TreeSet<String>();
        i.add("a");
        i.add("b");
        o.add("x");
        checkOutput(lep, i, o);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed");
    }
}
Also used : TreeSet(java.util.TreeSet) LineageInfo(org.apache.hadoop.hive.ql.tools.LineageInfo) Test(org.junit.Test)

Example 4 with LineageInfo

use of org.apache.hadoop.hive.ql.tools.LineageInfo in project hive by apache.

the class TestLineageInfo method testSimpleQuery3.

@Test
public void testSimpleQuery3() throws Exception {
    LineageInfo lep = new LineageInfo();
    lep.getLineageInfo("FROM (FROM src select src.key, src.value " + "WHERE src.key < 10 UNION ALL FROM src1 SELECT src1.* WHERE src1.key > 10 ) unioninput " + "INSERT OVERWRITE DIRECTORY '../../../../build/contrib/hive/ql/test/data/warehouse/union.out' " + "SELECT unioninput.*", ctx);
    TreeSet<String> i = new TreeSet<String>();
    TreeSet<String> o = new TreeSet<String>();
    i.add("src");
    i.add("src1");
    checkOutput(lep, i, o);
}
Also used : TreeSet(java.util.TreeSet) LineageInfo(org.apache.hadoop.hive.ql.tools.LineageInfo) Test(org.junit.Test)

Example 5 with LineageInfo

use of org.apache.hadoop.hive.ql.tools.LineageInfo in project hive by apache.

the class TestLineageInfo method testSimpleQuery2.

@Test
public void testSimpleQuery2() throws Exception {
    LineageInfo lep = new LineageInfo();
    lep.getLineageInfo("FROM (FROM src select src.key, src.value " + "WHERE src.key < 10 UNION ALL FROM src SELECT src.* WHERE src.key > 10 ) unioninput " + "INSERT OVERWRITE DIRECTORY '../../../../build/contrib/hive/ql/test/data/warehouse/union.out' " + "SELECT unioninput.*", ctx);
    TreeSet<String> i = new TreeSet<String>();
    TreeSet<String> o = new TreeSet<String>();
    i.add("src");
    checkOutput(lep, i, o);
}
Also used : TreeSet(java.util.TreeSet) LineageInfo(org.apache.hadoop.hive.ql.tools.LineageInfo) Test(org.junit.Test)

Aggregations

LineageInfo (org.apache.hadoop.hive.ql.tools.LineageInfo)6 Test (org.junit.Test)6 TreeSet (java.util.TreeSet)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 CliSessionState (org.apache.hadoop.hive.cli.CliSessionState)1 LogInitializationException (org.apache.hadoop.hive.common.LogUtils.LogInitializationException)1 SessionStream (org.apache.hadoop.hive.common.io.SessionStream)1 HiveConf (org.apache.hadoop.hive.conf.HiveConf)1 IDriver (org.apache.hadoop.hive.ql.IDriver)1 QueryInfo (org.apache.hadoop.hive.ql.history.HiveHistory.QueryInfo)1 TaskInfo (org.apache.hadoop.hive.ql.history.HiveHistory.TaskInfo)1