You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2021/02/19 05:58:12 UTC

[atlas] branch master updated: ATLAS-4169: Add Hive Location Path entities to HMS Hook

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

sarath pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new 47c18b9  ATLAS-4169: Add Hive Location Path entities to HMS Hook
47c18b9 is described below

commit 47c18b9419f825fd6a15bbf9f22196b4ef49aefe
Author: Radhika Kundam <rk...@cloudera.com>
AuthorDate: Thu Feb 18 16:26:41 2021 -0800

    ATLAS-4169: Add Hive Location Path entities to HMS Hook
    
    Signed-off-by: Sarath Subramanian <sa...@apache.org>
---
 .../org/apache/atlas/hive/hook/events/AlterDatabase.java  |  2 ++
 .../org/apache/atlas/hive/hook/events/CreateDatabase.java | 15 +++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterDatabase.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterDatabase.java
index 6b01c4e..d2623b3 100644
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterDatabase.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterDatabase.java
@@ -61,6 +61,8 @@ public class AlterDatabase extends CreateDatabase {
             AtlasEntity dbEntity = toDbEntity(newDb);
 
             ret.addEntity(dbEntity);
+
+            addLocationEntities(dbEntity, ret);
         } else {
             LOG.error("AlterDatabase.getEntities(): failed to retrieve db");
         }
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java
index 8305a44..bf5f562 100644
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java
@@ -68,6 +68,8 @@ public class CreateDatabase extends BaseHiveEvent {
             AtlasEntity dbEntity = toDbEntity(db);
 
             ret.addEntity(dbEntity);
+
+            addLocationEntities(dbEntity, ret);
         } else {
             LOG.error("CreateDatabase.getEntities(): failed to retrieve db");
         }
@@ -98,10 +100,7 @@ public class CreateDatabase extends BaseHiveEvent {
                         ret.addEntity(dbDDLEntity);
                     }
 
-                    AtlasEntity dbLocationEntity = createHiveLocationEntity(dbEntity, ret);
-                    if (dbLocationEntity != null) {
-                        ret.addEntity(dbLocationEntity);
-                    }
+                    addLocationEntities(dbEntity, ret);
                 } else {
                     LOG.error("CreateDatabase.getEntities(): failed to retrieve db");
                 }
@@ -112,4 +111,12 @@ public class CreateDatabase extends BaseHiveEvent {
 
         return ret;
     }
+
+    public void addLocationEntities(AtlasEntity dbEntity, AtlasEntitiesWithExtInfo ret) {
+        AtlasEntity dbLocationEntity = createHiveLocationEntity(dbEntity, ret);
+
+        if (dbLocationEntity != null) {
+            ret.addEntity(dbLocationEntity);
+        }
+    }
 }
\ No newline at end of file