Repository: atlas Updated Branches: refs/heads/branch-0.8 35579161d -> 5ff26af47
ATLAS-2213: Remove unused attributes from Hive hook (cherry picked from commit 96d4d31d0216061846d1fc894763fc50a1aaf8c7) Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/5ff26af4 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/5ff26af4 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/5ff26af4 Branch: refs/heads/branch-0.8 Commit: 5ff26af4778f63301b72da4aecea296b65f43075 Parents: 3557916 Author: Madhan Neethiraj <[email protected]> Authored: Mon Oct 16 08:34:08 2017 -0700 Committer: Madhan Neethiraj <[email protected]> Committed: Mon Oct 16 11:16:17 2017 -0700 ---------------------------------------------------------------------- .../org/apache/atlas/hive/hook/HiveHook.java | 23 +++++++------------- 1 file changed, 8 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/5ff26af4/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java ---------------------------------------------------------------------- diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java index f815773..0e8284d 100755 --- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java +++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java @@ -37,6 +37,7 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.TableType; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.FieldSchema; +import org.apache.hadoop.hive.ql.QueryPlan; import org.apache.hadoop.hive.ql.hooks.Entity; import org.apache.hadoop.hive.ql.hooks.Entity.Type; import org.apache.hadoop.hive.ql.hooks.ExecuteWithHookContext; @@ -171,18 +172,20 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext { // clone to avoid concurrent access try { final HiveEventContext event = new HiveEventContext(); + event.setInputs(hookContext.getInputs()); event.setOutputs(hookContext.getOutputs()); event.setHookType(hookContext.getHookType()); - final UserGroupInformation ugi = hookContext.getUgi() == null ? Utils.getUGI() : hookContext.getUgi(); + final UserGroupInformation ugi = hookContext.getUgi() == null ? Utils.getUGI() : hookContext.getUgi(); + final QueryPlan queryPlan = hookContext.getQueryPlan(); + event.setUgi(ugi); event.setUser(getUser(hookContext.getUserName(), hookContext.getUgi())); event.setOperation(OPERATION_MAP.get(hookContext.getOperationName())); - event.setQueryId(hookContext.getQueryPlan().getQueryId()); - event.setQueryStr(hookContext.getQueryPlan().getQueryStr()); - event.setQueryStartTime(hookContext.getQueryPlan().getQueryStartTime()); - event.setQueryType(hookContext.getQueryPlan().getQueryPlan().getQueryType()); + event.setQueryId(queryPlan.getQueryId()); + event.setQueryStr(queryPlan.getQueryStr()); + event.setQueryStartTime(queryPlan.getQueryStartTime()); event.setLineageInfo(hookContext.getLinfo()); if (executor == null) { @@ -1088,8 +1091,6 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext { private List<HookNotification.HookNotificationMessage> messages = new ArrayList<>(); - private String queryType; - public void setInputs(Set<ReadEntity> inputs) { this.inputs = inputs; } @@ -1126,10 +1127,6 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext { this.queryStartTime = queryStartTime; } - public void setQueryType(String queryType) { - this.queryType = queryType; - } - public void setLineageInfo(LineageInfo lineageInfo){ try { this.lineageInfo = ColumnLineageUtils.buildLineageMap(lineageInfo); @@ -1175,10 +1172,6 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext { return queryStartTime; } - public String getQueryType() { - return queryType; - } - public void addMessage(HookNotification.HookNotificationMessage message) { messages.add(message); }
