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

feat: jsonpath predicate support #41

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

akoshchiy
Copy link
Contributor

@akoshchiy akoshchiy commented Nov 27, 2023

  1. Added support of jsonpath predicates;
  2. Added path_match function (supporting @@ and json_path_match for Tracking: JSON functions and operators databend#11270);

Here I've tried to achieve the same behaviour of predicates like postgres has:

  1. Selecting the result of the predicate path from json should return the predicate result itself, so Selector::select returns true or false in jsonb format;
  2. json_path_exists always returns true on predicates, because selector always has the result on it (true or false)
  3. @ is forbidden in predicate expression;

I've found the good explanation here https://justatheory.com/2023/10/sql-jsonpath-operators/

@akoshchiy akoshchiy marked this pull request as ready for review November 27, 2023 21:19
@b41sh b41sh self-requested a review November 28, 2023 13:58
Copy link
Member

@b41sh b41sh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution @akoshchiy

@b41sh
Copy link
Member

b41sh commented Nov 29, 2023

https://justatheory.com/2023/10/sql-jsonpath-operators/
This article is really good. the document of JSON path is really a bit scarce, I'll add some references to this resource next.

@b41sh b41sh merged commit 582c139 into datafuselabs:main Nov 29, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants