You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/10/16 18:15:54 UTC

atlas git commit: ATLAS-2213: Remove unused attributes from Hive hook

Repository: atlas
Updated Branches:
  refs/heads/master 32fa4be52 -> 96d4d31d0


ATLAS-2213: Remove unused attributes from Hive hook


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/96d4d31d
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/96d4d31d
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/96d4d31d

Branch: refs/heads/master
Commit: 96d4d31d0216061846d1fc894763fc50a1aaf8c7
Parents: 32fa4be
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Mon Oct 16 08:34:08 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Oct 16 09:55:36 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/96d4d31d/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);
         }