You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by si...@apache.org on 2022/02/03 23:23:51 UTC
[atlas] branch master updated: ATLAS-4546: Hive DB creation fails when user provides both location & managedLocation
This is an automated email from the ASF dual-hosted git repository.
sidmishra 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 8543adb ATLAS-4546: Hive DB creation fails when user provides both location & managedLocation
8543adb is described below
commit 8543adb69d57584f8c1ca6401410df04867f34fb
Author: Radhika Kundam <rk...@cloudera.com>
AuthorDate: Tue Feb 1 15:03:48 2022 -0800
ATLAS-4546: Hive DB creation fails when user provides both location & managedLocation
Signed-off-by: Sidharth Mishra <si...@apache.org>
---
.../apache/atlas/utils/AtlasPathExtractorUtil.java | 84 +++++++++++++---------
1 file changed, 50 insertions(+), 34 deletions(-)
diff --git a/common/src/main/java/org/apache/atlas/utils/AtlasPathExtractorUtil.java b/common/src/main/java/org/apache/atlas/utils/AtlasPathExtractorUtil.java
index 01a67b7..cf8f262 100644
--- a/common/src/main/java/org/apache/atlas/utils/AtlasPathExtractorUtil.java
+++ b/common/src/main/java/org/apache/atlas/utils/AtlasPathExtractorUtil.java
@@ -228,18 +228,22 @@ public class AtlasPathExtractorUtil {
String subDirPath = parentPath + subDirName + Path.SEPARATOR;
String subDirQualifiedName = schemeAndBucketName + subDirPath + QNAME_SEP_METADATA_NAMESPACE + metadataNamespace;
- ret = new AtlasEntity(AWS_S3_V2_PSEUDO_DIR);
+ ret = context.getEntity(subDirQualifiedName);
- ret.setRelationshipAttribute(ATTRIBUTE_CONTAINER, parentObjId);
- ret.setAttribute(ATTRIBUTE_OBJECT_PREFIX, subDirPath);
- ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
- ret.setAttribute(ATTRIBUTE_NAME, subDirName);
+ if (ret == null) {
+ ret = new AtlasEntity(AWS_S3_V2_PSEUDO_DIR);
- if (LOG.isDebugEnabled()) {
- LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
- }
+ ret.setRelationshipAttribute(ATTRIBUTE_CONTAINER, parentObjId);
+ ret.setAttribute(ATTRIBUTE_OBJECT_PREFIX, subDirPath);
+ ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
+ ret.setAttribute(ATTRIBUTE_NAME, subDirName);
- context.putEntity(subDirQualifiedName, ret);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
+ }
+
+ context.putEntity(subDirQualifiedName, ret);
+ }
parentObjId = AtlasTypeUtil.getAtlasRelatedObjectId(ret, RELATIONSHIP_AWS_S3_V2_CONTAINER_CONTAINED);
parentPath = subDirPath;
@@ -332,17 +336,21 @@ public class AtlasPathExtractorUtil {
String subDirPath = parentPath + subDirName;
String subDirQualifiedName = schemeAndContainerName + subDirPath + QNAME_SEP_METADATA_NAMESPACE + metadataNamespace;
- ret = new AtlasEntity(ADLS_GEN2_DIRECTORY);
+ ret = context.getEntity(subDirQualifiedName);
- ret.setRelationshipAttribute(ATTRIBUTE_PARENT, parentObjId);
- ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
- ret.setAttribute(ATTRIBUTE_NAME, subDirName);
+ if (ret == null) {
+ ret = new AtlasEntity(ADLS_GEN2_DIRECTORY);
- if (LOG.isDebugEnabled()) {
- LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
- }
+ ret.setRelationshipAttribute(ATTRIBUTE_PARENT, parentObjId);
+ ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
+ ret.setAttribute(ATTRIBUTE_NAME, subDirName);
- context.putEntity(subDirQualifiedName, ret);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
+ }
+
+ context.putEntity(subDirQualifiedName, ret);
+ }
parentObjId = AtlasTypeUtil.getAtlasRelatedObjectId(ret, RELATIONSHIP_ADLS_GEN2_PARENT_CHILDREN);
parentPath = subDirPath + Path.SEPARATOR;
@@ -432,17 +440,21 @@ public class AtlasPathExtractorUtil {
String subDirPath = parentPath + subDirName;
String subDirQualifiedName = keyQNamePrefix + subDirPath + QNAME_SEP_METADATA_NAMESPACE + metadataNamespace;
- ret = new AtlasEntity(OZONE_KEY);
+ ret = context.getEntity(subDirQualifiedName);
- ret.setRelationshipAttribute(ATTRIBUTE_PARENT, parentObjId);
- ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
- ret.setAttribute(ATTRIBUTE_NAME, subDirName);
+ if (ret == null) {
+ ret = new AtlasEntity(OZONE_KEY);
- if (LOG.isDebugEnabled()) {
- LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
- }
+ ret.setRelationshipAttribute(ATTRIBUTE_PARENT, parentObjId);
+ ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
+ ret.setAttribute(ATTRIBUTE_NAME, subDirName);
- context.putEntity(subDirQualifiedName, ret);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
+ }
+
+ context.putEntity(subDirQualifiedName, ret);
+ }
parentObjId = AtlasTypeUtil.getAtlasRelatedObjectId(ret, RELATIONSHIP_OZONE_PARENT_CHILDREN);
parentPath = subDirPath + Path.SEPARATOR;;
@@ -504,18 +516,22 @@ public class AtlasPathExtractorUtil {
String subDirPath = parentPath + subDirName + Path.SEPARATOR;
String subDirQualifiedName = schemeAndBucketName + subDirPath + QNAME_SEP_METADATA_NAMESPACE + metadataNamespace;
- ret = new AtlasEntity(GCS_VIRTUAL_DIR);
+ ret = context.getEntity(subDirQualifiedName);
- ret.setRelationshipAttribute(ATTRIBUTE_GCS_PARENT, parentObjId);
- ret.setAttribute(ATTRIBUTE_OBJECT_PREFIX, parentPath);
- ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
- ret.setAttribute(ATTRIBUTE_NAME, subDirName);
+ if (ret == null) {
+ ret = new AtlasEntity(GCS_VIRTUAL_DIR);
- if (LOG.isDebugEnabled()) {
- LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
- }
+ ret.setRelationshipAttribute(ATTRIBUTE_GCS_PARENT, parentObjId);
+ ret.setAttribute(ATTRIBUTE_OBJECT_PREFIX, parentPath);
+ ret.setAttribute(ATTRIBUTE_QUALIFIED_NAME, subDirQualifiedName);
+ ret.setAttribute(ATTRIBUTE_NAME, subDirName);
- context.putEntity(subDirQualifiedName, ret);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("adding entity: typeName={}, qualifiedName={}", ret.getTypeName(), ret.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
+ }
+
+ context.putEntity(subDirQualifiedName, ret);
+ }
parentObjId = AtlasTypeUtil.getAtlasRelatedObjectId(ret, RELATIONSHIP_GCS_PARENT_CHILDREN);
parentPath = subDirPath;