Search in sources :

Example 1 with LineageLogger

use of org.apache.hadoop.hive.ql.hooks.LineageLogger in project hive by apache.

the class TestJdbcWithMiniHS2 method getVerticesFromHooks.

/**
 * Use the logic in LineageLogger to get vertices from Hook Contexts
 */
private List<Set<LineageLogger.Vertex>> getVerticesFromHooks() {
    List<Set<LineageLogger.Vertex>> verticesLists = new ArrayList<>();
    List<HookContext> hookList = ReadableHook.getHookList();
    for (HookContext hookContext : hookList) {
        QueryPlan plan = hookContext.getQueryPlan();
        LineageCtx.Index index = hookContext.getIndex();
        assertNotNull(index);
        List<LineageLogger.Edge> edges = LineageLogger.getEdges(plan, index);
        Set<LineageLogger.Vertex> vertices = LineageLogger.getVertices(edges);
        verticesLists.add(vertices);
    }
    return verticesLists;
}
Also used : LineageLogger(org.apache.hadoop.hive.ql.hooks.LineageLogger) ResultSet(java.sql.ResultSet) Set(java.util.Set) ArrayList(java.util.ArrayList) HookContext(org.apache.hadoop.hive.ql.hooks.HookContext) LineageCtx(org.apache.hadoop.hive.ql.optimizer.lineage.LineageCtx) QueryPlan(org.apache.hadoop.hive.ql.QueryPlan)

Aggregations

ResultSet (java.sql.ResultSet)1 ArrayList (java.util.ArrayList)1 Set (java.util.Set)1 QueryPlan (org.apache.hadoop.hive.ql.QueryPlan)1 HookContext (org.apache.hadoop.hive.ql.hooks.HookContext)1 LineageLogger (org.apache.hadoop.hive.ql.hooks.LineageLogger)1 LineageCtx (org.apache.hadoop.hive.ql.optimizer.lineage.LineageCtx)1