Commit 9f5b7861 by mayanknj Committed by Madhan Neethiraj

ATLAS-3590: fix HiveHook to avoid incorrect alter-table-property notifications

parent c6661ff1
...@@ -94,7 +94,7 @@ public class HiveMetastoreHookImpl extends MetaStoreEventListener { ...@@ -94,7 +94,7 @@ public class HiveMetastoreHookImpl extends MetaStoreEventListener {
context.setOperation(ALTERTABLE_RENAME); context.setOperation(ALTERTABLE_RENAME);
} else if (isColumnRename(oldTable, newTable, context)) { } else if (isColumnRename(oldTable, newTable, context)) {
context.setOperation(ALTERTABLE_RENAMECOL); context.setOperation(ALTERTABLE_RENAMECOL);
} else { } else if(isAlterTableProperty(tableEvent)){
context.setOperation(ALTERTABLE_PROPERTIES); // map other alter table operations to ALTERTABLE_PROPERTIES context.setOperation(ALTERTABLE_PROPERTIES); // map other alter table operations to ALTERTABLE_PROPERTIES
} }
...@@ -190,4 +190,20 @@ public class HiveMetastoreHookImpl extends MetaStoreEventListener { ...@@ -190,4 +190,20 @@ public class HiveMetastoreHookImpl extends MetaStoreEventListener {
return isColumnRename; return isColumnRename;
} }
private boolean isAlterTableProperty(AlterTableEvent tableEvent) {
final boolean ret;
String oldTableModifiedTime = tableEvent.getOldTable().getParameters().get("last_modified_time");
String newTableModifiedTime = tableEvent.getNewTable().getParameters().get("last_modified_time");
if (oldTableModifiedTime == null) {
ret = newTableModifiedTime != null;
} else {
ret = !oldTableModifiedTime.equals(newTableModifiedTime);
}
return ret;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment