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

Filter: operators for working with arrays/lists #318

Closed
rpbouman opened this issue Dec 22, 2024 · 1 comment
Closed

Filter: operators for working with arrays/lists #318

rpbouman opened this issue Dec 22, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@rpbouman
Copy link
Owner

rpbouman commented Dec 22, 2024

In some cases it may be useful to apply a filter based on array content. These would really be new filter operators that would be applicable only to list/array items

list_has_all: https://duckdb.org/docs/sql/functions/list#list_has_alllist-sub-list
list_has_any: https://duckdb.org/docs/sql/functions/list#list_has_anylist1-list2

Note: these would be the DuckDB builtins to use.
As filter options these would be available in addition to the current options.
(Maybe consider removing the LIKE style operators for lists?)

Both these functions could be negated as well, adding up to 4 new filter operators:

List includes (any)
List excludes = ~list includes

List includes all
List excludes = ~list includes all.

The UI would have to adapt to make it possible to select array elements.
The query behind the picklist should unnest the array value and present the distinct list of values (array elements).
The user can then pick values as usual, and they would be added to the filter's value list.
When applying these filter items to the query, we would construct array values from the list values and use them as argument to the list_has_all and list_has_any functions.

@rpbouman rpbouman added the enhancement New feature or request label Dec 22, 2024
@rpbouman
Copy link
Owner Author

rpbouman commented Dec 22, 2024

@rpbouman rpbouman changed the title Filter: operators for working with arrays/lists Filter: operators for working with arrays/lists, maps Dec 22, 2024
@rpbouman rpbouman self-assigned this Dec 29, 2024
@rpbouman rpbouman changed the title Filter: operators for working with arrays/lists, maps Filter: operators for working with arrays/lists Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant