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_INSERT" function #11301

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

[Feature][SDK] Transform SQL supports "JSON_ARRAY_INSERT" function #11301

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

Comments

@Zkplo
Copy link
Contributor

Zkplo commented Oct 8, 2024

Description

JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...):
Updates a JSON document, inserting into an array within the document and returning the modified document. 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 or contains a * or ** wildcard or does not end with an array element identifier.

Use case

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

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

@Zkplo Zkplo changed the title [Feature][SDK] Transform SQL supports "JSON_ARRAY_APPEND" function [Feature][SDK] Transform SQL supports "JSON_ARRAY_INSERT" function Oct 10, 2024
@aloyszhang aloyszhang added this to the 1.14.0 milestone Oct 10, 2024
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