From 723dedd50155e209fc5835d84f6be9e7f72b6129 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:42:30 +0530 Subject: [PATCH 1/2] fix: get optional default --- .../repository/store/graph/v2/AtlasEntityComparator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java index ce38f4898e..c0af361bb0 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java @@ -90,7 +90,9 @@ private AtlasEntityDiffResult getDiffResult(AtlasEntity updatedEntity, AtlasEnti if (entry.getValue() == null && isDefaultValueNotNull) { switch (category) { case PRIMITIVE: - newVal = attribute.getAttributeType().createDefaultValue(); + newVal = attribute.getAttributeDef().getIsOptional() ? + attribute.getAttributeType().createOptionalDefaultValue(): + attribute.getAttributeType().createDefaultValue(); break; case ARRAY: newVal = new ArrayList<>(); From 5f724fc9c84e75ad02805f8671e501e9bd337c24 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:46:57 +0530 Subject: [PATCH 2/2] rev: revert the change back as it doesn't do anything extra --- .../repository/store/graph/v2/AtlasEntityComparator.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java index c0af361bb0..ce38f4898e 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityComparator.java @@ -90,9 +90,7 @@ private AtlasEntityDiffResult getDiffResult(AtlasEntity updatedEntity, AtlasEnti if (entry.getValue() == null && isDefaultValueNotNull) { switch (category) { case PRIMITIVE: - newVal = attribute.getAttributeDef().getIsOptional() ? - attribute.getAttributeType().createOptionalDefaultValue(): - attribute.getAttributeType().createDefaultValue(); + newVal = attribute.getAttributeType().createDefaultValue(); break; case ARRAY: newVal = new ArrayList<>();