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

chaitalithombare 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 02065d00f ATLAS-5034: Entities not created in Atlas when hive table 
created on top a OFS/O3FS bucket/volume (#379)
02065d00f is described below

commit 02065d00f5b96f53bc420c8c04cc09b6d035dd51
Author: Aditya Gupta <aditya.gu...@freestoneinfotech.com>
AuthorDate: Wed Jun 18 16:41:52 2025 +0530

    ATLAS-5034: Entities not created in Atlas when hive table created on top a 
OFS/O3FS bucket/volume (#379)
---
 .../org/apache/atlas/utils/AtlasPathExtractorUtil.java  |  6 +++---
 .../apache/atlas/utils/AtlasPathExtractorUtilTest.java  | 17 +++++++----------
 2 files changed, 10 insertions(+), 13 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 06558737f..7e7904a85 100644
--- a/common/src/main/java/org/apache/atlas/utils/AtlasPathExtractorUtil.java
+++ b/common/src/main/java/org/apache/atlas/utils/AtlasPathExtractorUtil.java
@@ -90,7 +90,7 @@ public class AtlasPathExtractorUtil {
     }
 
     public static AtlasEntityWithExtInfo getPathEntity(Path path, 
PathExtractorContext context) {
-        if (StringUtils.isEmpty(path.toString())) {
+        if (path == null || StringUtils.isEmpty(path.toString())) {
             throw new IllegalArgumentException("Invalid Input: Path is Null");
         }
 
@@ -500,7 +500,7 @@ public class AtlasPathExtractorUtil {
         }
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("<== addOzonePathEntity(strPath={})", path.toString());
+            LOG.debug("<== addOzonePathEntity(strPath={})", path);
         }
 
         return currentOfsKeyEntity;
@@ -555,7 +555,7 @@ public class AtlasPathExtractorUtil {
         }
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("<== addOzonePathEntity(strPath={})", path.toString());
+            LOG.debug("<== addOzonePathEntity(strPath={})", path);
         }
 
         return currentO3fsKeyEntity;
diff --git 
a/common/src/test/java/org/apache/atlas/utils/AtlasPathExtractorUtilTest.java 
b/common/src/test/java/org/apache/atlas/utils/AtlasPathExtractorUtilTest.java
index 83c84d785..14d90d68c 100644
--- 
a/common/src/test/java/org/apache/atlas/utils/AtlasPathExtractorUtilTest.java
+++ 
b/common/src/test/java/org/apache/atlas/utils/AtlasPathExtractorUtilTest.java
@@ -20,6 +20,7 @@ package org.apache.atlas.utils;
 
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
+import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.fs.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -28,7 +29,6 @@ import org.testng.annotations.Test;
 
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Objects;
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
@@ -101,11 +101,11 @@ public class AtlasPathExtractorUtilTest {
         assertNotNull(entity);
         verifyOzoneKeyEntity(entity, validator);
 
-        if (entity.getTypeName() == OZONE_KEY) {
+        if (StringUtils.equals(entity.getTypeName(), OZONE_KEY)) {
             verifyReferredAndKnownEntities(entityWithExtInfo, 
extractorContext, validator, validator.knownEntitiesCountTillKey, 2);
-        } else if (entity.getTypeName() == OZONE_BUCKET) {
+        } else if (StringUtils.equals(entity.getTypeName(), OZONE_BUCKET)) {
             verifyReferredAndKnownEntities(entityWithExtInfo, 
extractorContext, validator, validator.knownEntitiesCountTillBucket, 2);
-        } else if (entity.getTypeName() == OZONE_VOLUME) {
+        } else if (StringUtils.equals(entity.getTypeName(), OZONE_VOLUME)) {
             verifyReferredAndKnownEntities(entityWithExtInfo, 
extractorContext, validator, validator.knownEntitiesCountTillVolume, 1);
         }
     }
@@ -340,14 +340,11 @@ public class AtlasPathExtractorUtilTest {
     }
 
     private void verifyOzoneKeyEntity(AtlasEntity entity, OzoneKeyValidator 
validator) {
-        if (Objects.equals(entity.getTypeName(), OZONE_KEY)) {
-            assertEquals(entity.getTypeName(), OZONE_KEY);
+        if (StringUtils.equals(entity.getTypeName(), OZONE_KEY)) {
             assertTrue(validator.validateNameQName(entity));
-        } else if (Objects.equals(entity.getTypeName(), OZONE_BUCKET)) {
-            assertEquals(entity.getTypeName(), OZONE_BUCKET);
+        } else if (StringUtils.equals(entity.getTypeName(), OZONE_BUCKET)) {
             assertTrue(validator.validateNameQName(entity));
-        } else if (Objects.equals(entity.getTypeName(), OZONE_VOLUME)) {
-            assertEquals(entity.getTypeName(), OZONE_VOLUME);
+        } else if (StringUtils.equals(entity.getTypeName(), OZONE_VOLUME)) {
             assertTrue(validator.validateNameQName(entity));
         }
     }

Reply via email to