Repository: atlas
Updated Branches:
  refs/heads/branch-1.0 71ac87813 -> 6d3f17df3


ATLAS-2757: fix for NPE in Hive hook in handling column-rename on temporary 
table

(cherry picked from commit 75da039043f61c33330686e362de5c8c35996906)


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

Branch: refs/heads/branch-1.0
Commit: 6d3f17df30f1eb3c320bfe51bafde7f84d2e0884
Parents: 71ac878
Author: Madhan Neethiraj <mad...@apache.org>
Authored: Thu Jun 14 15:21:19 2018 -0700
Committer: Madhan Neethiraj <mad...@apache.org>
Committed: Thu Jun 14 17:21:41 2018 -0700

----------------------------------------------------------------------
 .../atlas/hive/hook/events/AlterTableRenameCol.java    | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/6d3f17df/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterTableRenameCol.java
----------------------------------------------------------------------
diff --git 
a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterTableRenameCol.java
 
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterTableRenameCol.java
index 60aea94..5bbdd81 100644
--- 
a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterTableRenameCol.java
+++ 
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterTableRenameCol.java
@@ -54,10 +54,17 @@ public class AlterTableRenameCol extends AlterTable {
             return null;
         }
 
-        List<HookNotification> ret = new 
ArrayList<>(super.getNotificationMessages());
+        List<HookNotification> baseMsgs = super.getNotificationMessages();
 
-        Table oldTable = 
getHiveContext().getInputs().iterator().next().getTable();
-        Table newTable = 
getHiveContext().getOutputs().iterator().next().getTable();
+        if (CollectionUtils.isEmpty(baseMsgs)) {
+            LOG.debug("Skipped processing of column-rename (on a temporary 
table?)");
+
+            return null;
+        }
+
+        List<HookNotification> ret      = new ArrayList<>(baseMsgs);
+        Table                  oldTable = 
getHiveContext().getInputs().iterator().next().getTable();
+        Table                  newTable = 
getHiveContext().getOutputs().iterator().next().getTable();
 
         newTable = getHive().getTable(newTable.getDbName(), 
newTable.getTableName());
 

Reply via email to