Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][SDK] Transform SQL supports "JSON_ARRAY_APPEND" function #11300

Closed
2 tasks done
Zkplo opened this issue Oct 8, 2024 · 0 comments · Fixed by #11310
Closed
2 tasks done

[Feature][SDK] Transform SQL supports "JSON_ARRAY_APPEND" function #11300

Zkplo opened this issue Oct 8, 2024 · 0 comments · Fixed by #11310
Assignees
Milestone

Comments

@Zkplo
Copy link
Contributor

Zkplo commented Oct 8, 2024

Description

JSON_ARRAY_APPEND(json_doc, path, val[, path, val] ...):
Appends values to the end of the indicated arrays within a JSON document and returns the result. Returns NULL if any argument is NULL. An error occurs if the json_doc argument is not a valid JSON document or any path argument is not a valid path expression.

Use case

JSON_ARRAY_APPEND('["a", ["b", "c"], "d"]','$[1]', 1);  -> ["a", ["b", "c", 1], "d"];
JSON_ARRAY_APPEND('["a", ["b", "c"], "d"]','$[0]', 2);  -> [["a", 2], ["b", "c"], "d"];
JSON_ARRAY_APPEND('["a", ["b", "c"], "d"]','$[1][0]', 3);  -> ["a", [["b", 3], "c"], "d"];
JSON_ARRAY_APPEND('{"a": 1, "b": [2, 3], "c": 4}','$.b', 'x');  -> {"a": 1, "b": [2, 3, "x"], "c": 4};
JSON_ARRAY_APPEND('{"a": 1, "b": [2, 3], "c": 4}','$.c', 'y');  -> {"a": 1, "b": [2, 3], "c": [4, "y"]};
JSON_ARRAY_APPEND('{"a": 1}','$', 'z');  -> [{"a": 1}, "z"];

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants