From 35e8a2dfb97142e377647c8b76f897fe87e0a223 Mon Sep 17 00:00:00 2001 From: aditya-gupta36 Date: Wed, 11 Mar 2026 18:01:00 +0530 Subject: [PATCH] ATLAS-5199: Impala startTime attribute changes to null from EMPTY string, after 1 retry on NotificationHookConsumer --- .../org/apache/atlas/type/AtlasStructType.java | 17 +++++++++++++++++ .../store/graph/v2/EntityGraphMapper.java | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java index 6197df3724f..5aef9d08db6 100644 --- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java +++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java @@ -484,6 +484,10 @@ public void normalizeAttributeValues(AtlasStruct obj) { if (obj.hasAttribute(attributeName)) { Object attributeValue = getNormalizedValue(obj.getAttribute(attributeName), attributeDef); + if (attributeValue == null && obj.getAttribute(attributeName) != null) { + continue; + } + obj.setAttribute(attributeName, attributeValue); } else if (!attributeDef.getIsOptional()) { obj.setAttribute(attributeName, createDefaultValue(attributeDef)); @@ -500,6 +504,10 @@ public void normalizeAttributeValuesForUpdate(AtlasStruct obj) { if (obj.hasAttribute(attributeName)) { Object attributeValue = getNormalizedValueForUpdate(obj.getAttribute(attributeName), attributeDef); + if (attributeValue == null && obj.getAttribute(attributeName) != null) { + continue; + } + obj.setAttribute(attributeName, attributeValue); } } @@ -514,6 +522,10 @@ public void normalizeAttributeValues(Map obj) { if (obj.containsKey(attributeName)) { Object attributeValue = getNormalizedValue(obj.get(attributeName), attributeDef); + if (attributeValue == null && obj.get(attributeName) != null) { + continue; + } + obj.put(attributeName, attributeValue); } else if (!attributeDef.getIsOptional()) { obj.put(attributeName, createDefaultValue(attributeDef)); @@ -530,6 +542,11 @@ public void normalizeAttributeValuesForUpdate(Map obj) { if (obj.containsKey(attrName)) { attrValue = getNormalizedValueForUpdate(attrValue, attrDef); + + if (attrValue == null && obj.get(attrName) != null) { + continue; + } + obj.put(attrName, attrValue); } } diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java index 3b7f4a51076..5913af6d229 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java @@ -1551,6 +1551,24 @@ private void mapAttribute(AtlasAttribute attribute, Object attrValue, AtlasVerte } } } + } else if (attrValue instanceof String && StringUtils.isEmpty((String) attrValue)) { + if (attrType.getTypeCategory() == TypeCategory.PRIMITIVE) { + Object normalizedValue = attrType.getNormalizedValue(attrValue); + if (normalizedValue == null) { + AtlasAttributeDef attributeDef = attribute.getAttributeDef(); + if (attributeDef.getDefaultValue() != null) { + attrValue = attrType.createDefaultValue(attributeDef.getDefaultValue()); + } else { + if (attributeDef.getIsOptional()) { + attrValue = attrType.createOptionalDefaultValue(); + } else { + attrValue = attrType.createDefaultValue(); + } + } + } else { + attrValue = normalizedValue; + } + } } if (attrType.getTypeCategory() == TypeCategory.PRIMITIVE || attrType.getTypeCategory() == TypeCategory.ENUM) {