This is an automated email from the ASF dual-hosted git repository.
sarath pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 8c41fc0 ATLAS-4169: Add Hive Location Path entities to HMS Hook
8c41fc0 is described below
commit 8c41fc0d76dbeab72af529162f8d911f592b11cc
Author: Radhika Kundam <[email protected]>
AuthorDate: Thu Feb 18 16:26:41 2021 -0800
ATLAS-4169: Add Hive Location Path entities to HMS Hook
Signed-off-by: Sarath Subramanian <[email protected]>
(cherry picked from commit 47c18b9419f825fd6a15bbf9f22196b4ef49aefe)
---
.../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