Search in sources :

Example 6 with HookContext

use of org.apache.hadoop.hive.ql.hooks.HookContext 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

HookContext (org.apache.hadoop.hive.ql.hooks.HookContext)6 ArrayList (java.util.ArrayList)3 WriteEntity (org.apache.hadoop.hive.ql.hooks.WriteEntity)3 HiveSemanticAnalyzerHookContext (org.apache.hadoop.hive.ql.parse.HiveSemanticAnalyzerHookContext)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 Map (java.util.Map)2 AtlasHiveHookContext (org.apache.atlas.hive.hook.AtlasHiveHookContext)2 AtlasEntity (org.apache.atlas.model.instance.AtlasEntity)2 Metrics (org.apache.hadoop.hive.common.metrics.common.Metrics)2 TaskResult (org.apache.hadoop.hive.ql.exec.TaskResult)2 TaskRunner (org.apache.hadoop.hive.ql.exec.TaskRunner)2 ExecuteWithHookContext (org.apache.hadoop.hive.ql.hooks.ExecuteWithHookContext)2 MetricsQueryLifeTimeHook (org.apache.hadoop.hive.ql.hooks.MetricsQueryLifeTimeHook)2 PrivateHookContext (org.apache.hadoop.hive.ql.hooks.PrivateHookContext)2 QueryLifeTimeHook (org.apache.hadoop.hive.ql.hooks.QueryLifeTimeHook)2 QueryLifeTimeHookContext (org.apache.hadoop.hive.ql.hooks.QueryLifeTimeHookContext)2