tigrisdata-archive / tigris

Tigris is an Open Source Serverless NoSQL Database and Search Platform.
https://www.tigrisdata.com/
Apache License 2.0
905 stars 38 forks source link

Support filter's dot notation for arrays #838

Open rumyantseva opened 1 year ago

rumyantseva commented 1 year ago

Is your feature request related to a problem? Please describe.

To support more user queries, we need the ability to use "dot notation" in the filter when searching for values in arrays.

Examples:

Usage example:

filter = `{"foo.0.bar.1": "hello"}` // the exact array element is "hello"
filter = `{"foo.bar": "hello"}` // any element of `foo.*.bar.*` array is "hello"

Additional context

To support more query pushdown cases in FerretDB.

himank commented 1 year ago

@garrensmith let's think about this use case as well for filtering on array fields.

garrensmith commented 1 year ago

Nice. This should be possible with the secondary indexes. We have to change the keybuilder and filter to support nested queries. The part I'm uncertain around is the foo.Position1.bar.Position2 I think that part would have to be done in memory.

kesavkolla commented 1 year ago

Add support for lambda style filtering. There are two examples we can refer to:

duckdb nested functions: https://duckdb.org/docs/sql/functions/nested - list_filter jsonpath - https://goessner.net/articles/JsonPath/