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

[Enhancement]: Support json functions: 'json_contains_all' and 'json_contains_any' #25276

Closed
1 task done
xiaocai2333 opened this issue Jul 3, 2023 · 5 comments
Closed
1 task done
Assignees
Labels
kind/enhancement Issues or changes related to enhancement stale indicates no udpates for 30 days

Comments

@xiaocai2333
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What would you like to be added?

json_contains_all(json_array, list_element) json_array contains all the elements of the list_element.

{"x": [1,2,3,4,5,7,8]}
json_contains_all(x, [1,2,8]) ==> true
json_contains_all(x, [4,5,6]) ==> false 6 is not exists

json_contains_any(json_array, list_element) json_array contains any of the element of the list_element.

{"x": [1,2,3,4,5,7,8]}
json_contains_any(x, [1,2,8]) ==> true
json_contains_any(x, [4,5,6]) ==> true
json_contains_any(x, [6,9]) ==> false

Why is this needed?

No response

Anything else?

No response

@xiaocai2333 xiaocai2333 added the kind/enhancement Issues or changes related to enhancement label Jul 3, 2023
@xiaocai2333
Copy link
Contributor Author

/assign

@stale
Copy link

stale bot commented Aug 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

@stale stale bot added the stale indicates no udpates for 30 days label Aug 2, 2023
@xiaofan-luan
Copy link
Collaborator

keep it

@xiaocai2333
Copy link
Contributor Author

xiaocai2333 commented Aug 14, 2023

/assign @binbinlv please add test cases about json_contains.
we support:
{"x": [1,2,3]}
json_contains(json_array, 1) ==> true
{"x": [1.1,2.2,3.3]}
json_contains(json_array, 1.1) ==> true
{"x": ["abc", "def", "ghi"]}
json_contains(json_array, "abc") == > true
{"x": [true, false]}
json_contains(json_array, false) ==> true
{"x": [[1,2,3,4], [5,6,7,8]]}
json_contains(json_array, [1,2,3,4]) element is a list.
{"x": [[1,2,3,4], [1,2.2,false,"abcd"]]}
json_contains(json_array, [1,2.2, false,"abcd"]) element is a list with different type.

{"x": [1,2,3,4,5,6]}
json_contains_all(json_array, [1,2,3,4]) ==> true
{"x": [1,2.2, false,"abcd"]}
json_contains_all(json_array, [1,2.2, false,"abcd"]) ==> true
{"x": [[1,2,3],[4,5,6]]}
json_contains_all(json_array, [[1,2,3],[4,5,6]]) ==> true

{"x": [1,3,5,7]}
json_contains_any(json_array, [1,2,3,4]) == > true
{"x": ["abcd", "defg"]}
json_contains_any(json_array, [1,2.2, false,"abcd"]) ==> true
{"x": [[1,2,3]]}
json_contains_any(json_array, [[1,2,3],[4,5,6]]) ==> true

@stale
Copy link

stale bot commented Sep 13, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

@stale stale bot added the stale indicates no udpates for 30 days label Sep 13, 2023
@stale stale bot closed this as completed Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Issues or changes related to enhancement stale indicates no udpates for 30 days
Projects
None yet
Development

No branches or pull requests

2 participants