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 2019/11/28 18:30:15 UTC
[atlas] branch master updated: ATLAS-3539: fixed Hive metastore
hook to populate hive_db.ownerType,
and not update hive_db.description when null
This is an automated email from the ASF dual-hosted git repository.
madhan 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 c6661ff ATLAS-3539: fixed Hive metastore hook to populate hive_db.ownerType, and not update hive_db.description when null
c6661ff is described below
commit c6661ff15c15856ae030c95ffbbf808ff0850d5a
Author: Mandar Ambawane <ma...@freestoneinfotech.com>
AuthorDate: Wed Nov 27 15:23:20 2019 +0530
ATLAS-3539: fixed Hive metastore hook to populate hive_db.ownerType, and not update hive_db.description when null
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
---
.../main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java | 6 +++++-
.../main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java | 4 ++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
index 851582c..425be59 100644
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
@@ -314,7 +314,11 @@ public abstract class BaseHiveEvent {
ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, dbQualifiedName);
ret.setAttribute(ATTRIBUTE_NAME, dbName);
- ret.setAttribute(ATTRIBUTE_DESCRIPTION, db.getDescription());
+
+ if (StringUtils.isNotEmpty(db.getDescription())) {
+ ret.setAttribute(ATTRIBUTE_DESCRIPTION, db.getDescription());
+ }
+
ret.setAttribute(ATTRIBUTE_OWNER, db.getOwnerName());
ret.setAttribute(ATTRIBUTE_CLUSTER_NAME, getMetadataNamespace());
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 7bea779..c8a9ce3 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
@@ -61,6 +61,10 @@ public class CreateDatabase extends BaseHiveEvent {
Database db = dbEvent.getDatabase();
if (db != null) {
+ db = context.getMetastoreHandler().get_database(db.getName());
+ }
+
+ if (db != null) {
AtlasEntity dbEntity = toDbEntity(db);
ret.addEntity(dbEntity);