fix(dynamodb): remove duplicate list_append handler that breaks nested expressions (#321)

The original list_append handler (case-sensitive, using extractFunctionArgs with
naive comma splitting) shadows the #317 handler (case-insensitive, paren-aware
findNextComma + evaluateSetExpr). Nested expressions like
list_append(if_not_exists(items, :e), :v) hit the old handler first, which mangles
the arguments. Delete the old handler since #317's is a strict superset.
This commit is contained in:
TiM authored and GitHub committed 2026-04-09 21:44:38 -05:00
1 parent 89a07448c0
commit 92ba56b086
1 file changed
-22
@@ -965,28 +965,6 @@ public class DynamoDbService {
setValueAtPath(item, attrPath, resolved, exprAttrNames);
}
}
} else if (valuePart.startsWith("list_append(")) {
String[] args = extractFunctionArgs(valuePart);
if (args.length == 2) {
String arg1 = args[0].trim();
String arg2 = args[1].trim();
JsonNode list1 = arg1.startsWith(":") && exprAttrValues != null
? exprAttrValues.get(arg1)
: item.get(resolveAttributeName(arg1, exprAttrNames));
JsonNode list2 = arg2.startsWith(":") && exprAttrValues != null
? exprAttrValues.get(arg2)
: item.get(resolveAttributeName(arg2, exprAttrNames));
if (list1 != null && list2 != null && list1.has("L") && list2.has("L")) {
com.fasterxml.jackson.databind.node.ArrayNode merged =
com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.arrayNode();
list1.get("L").forEach(merged::add);
list2.get("L").forEach(merged::add);
com.fasterxml.jackson.databind.node.ObjectNode result =
com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
result.set("L", merged);
item.set(attrName, result);
}
}
} else if (valuePart.toLowerCase().startsWith("list_append(")) {
int open = valuePart.indexOf('(');
int close = valuePart.lastIndexOf(')');