Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 8f5c26429 -> 218797aa4


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/218797aa
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/218797aa
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/218797aa

Branch: refs/heads/branch-0.8
Commit: 218797aa491668a713bd7d446dcdbf392b3469c2
Parents: 8f5c264
Author: Madhan Neethiraj <[email protected]>
Authored: Thu Jun 14 15:21:19 2018 -0700
Committer: Madhan Neethiraj <[email protected]>
Committed: Thu Jun 14 17:38:46 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/218797aa/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 7c936e4..9f36cb8 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
@@ -55,10 +55,17 @@ public class AlterTableRenameCol extends AlterTable {
             return null;
         }
 
-        List<HookNotificationMessage> ret = new 
ArrayList<>(super.getNotificationMessages());
+        List<HookNotificationMessage> 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<HookNotificationMessage> 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