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:31:35 UTC
[atlas] branch branch-2.0 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 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 07bd944 ATLAS-3539: fixed Hive metastore hook to populate hive_db.ownerType, and not update hive_db.description when null
07bd944 is described below
commit 07bd944c7d9eeaa23323c61e1d567e51132b1e55
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>
(cherry picked from commit c6661ff15c15856ae030c95ffbbf808ff0850d5a)
---
.../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 556def9..08b8fa8 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
@@ -317,7 +317,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);