fix(dynamodb): resolve nested document paths in ADD and DELETE update actions (#1908)

This commit is contained in:
TiM authored and GitHub committed 2026-07-29 21:56:48 -05:00
1 parent 7d961068e1
commit c0522593e5
3 files changed
+266 -7

No files matched your search

@@ -1722,15 +1722,15 @@ public class DynamoDbService {
String[] parts = clause.split("\\s+", 3);
if (parts.length < 2) break;
String attrName = resolveAttributeName(parts[0], exprAttrNames);
String attrPath = parts[0];
String valuePlaceholder = parts[1].replaceAll(",.*", "").trim();
if (valuePlaceholder.startsWith(":") && exprAttrValues != null) {
JsonNode addValue = exprAttrValues.get(valuePlaceholder);
if (addValue != null) {
JsonNode existingValue = item.get(attrName);
JsonNode existingValue = getValueAtPath(item, attrPath, exprAttrNames);
JsonNode newValue = applyAddOperation(existingValue, addValue);
item.set(attrName, newValue);
setValueAtPath(item, attrPath, newValue, exprAttrNames);
}
}
@@ -1833,19 +1833,19 @@ public class DynamoDbService {
String[] parts = clause.split("\\s+", 3);
if (parts.length < 2) break;
String attrName = resolveAttributeName(parts[0], exprAttrNames);
String attrPath = parts[0];
String valuePlaceholder = parts[1].replaceAll(",.*", "").trim();
if (valuePlaceholder.startsWith(":") && exprAttrValues != null) {
JsonNode deleteValue = exprAttrValues.get(valuePlaceholder);
if (deleteValue != null) {
JsonNode existingValue = item.get(attrName);
JsonNode existingValue = getValueAtPath(item, attrPath, exprAttrNames);
if (existingValue != null) {
JsonNode newValue = applyDeleteOperation(existingValue, deleteValue);
if (newValue == null) {
item.remove(attrName);
removeValueAtPath(item, attrPath, exprAttrNames);
} else {
item.set(attrName, newValue);
setValueAtPath(item, attrPath, newValue, exprAttrNames);
}
}
}