databendlabs / jsonb

JSONB implement in rust
Apache License 2.0
65 stars 11 forks source link

feat: jsonpath predicate support #41

Closed akoshchiy closed 11 months ago

akoshchiy commented 11 months ago
  1. Added support of jsonpath predicates;
  2. Added path_match function (supporting @@ and json_path_match for https://github.com/datafuselabs/databend/issues/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/

b41sh commented 11 months ago

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.