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 2020/02/07 06:26:16 UTC

[atlas] 01/02: ATLAS-3608: Hive Bridge: Hive Metastore: Alter Table Query Not Handled Correctly.

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 04556cf265b85f0aef3479ed0bb49e998db67ac4
Author: Ashutosh Mestry <am...@cloudera.com>
AuthorDate: Thu Feb 6 14:05:02 2020 -0800

    ATLAS-3608: Hive Bridge: Hive Metastore: Alter Table Query Not Handled Correctly.
    
    (cherry picked from commit 984b359cf9cf0e951af274c8319ace2f4e2a3a74)
---
 .../java/org/apache/atlas/hive/hook/HiveMetastoreHookImpl.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveMetastoreHookImpl.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveMetastoreHookImpl.java
index 1585b43..3c0f0c1 100644
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveMetastoreHookImpl.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveMetastoreHookImpl.java
@@ -94,7 +94,8 @@ public class HiveMetastoreHookImpl extends MetaStoreEventListener {
             context.setOperation(ALTERTABLE_RENAME);
         } else if (isColumnRename(oldTable, newTable, context)) {
             context.setOperation(ALTERTABLE_RENAMECOL);
-        } else if(isAlterTableProperty(tableEvent)){
+        } else if(isAlterTableProperty(tableEvent, "last_modified_time") ||
+                isAlterTableProperty(tableEvent, "transient_lastDdlTime")) {
             context.setOperation(ALTERTABLE_PROPERTIES); // map other alter table operations to ALTERTABLE_PROPERTIES
         }
 
@@ -191,10 +192,10 @@ public class HiveMetastoreHookImpl extends MetaStoreEventListener {
         return isColumnRename;
     }
 
-    private boolean isAlterTableProperty(AlterTableEvent tableEvent) {
+    private boolean isAlterTableProperty(AlterTableEvent tableEvent, String propertyToCheck) {
         final boolean ret;
-        String        oldTableModifiedTime = tableEvent.getOldTable().getParameters().get("last_modified_time");
-        String        newTableModifiedTime = tableEvent.getNewTable().getParameters().get("last_modified_time");
+        String        oldTableModifiedTime = tableEvent.getOldTable().getParameters().get(propertyToCheck);
+        String        newTableModifiedTime = tableEvent.getNewTable().getParameters().get(propertyToCheck);
 
 
         if (oldTableModifiedTime == null) {