cube-js / cube-js/cube

Regex Support in Filter

Open
#3,499 3 comments 0 reactions 0 assignees View on GitHub
backend:server help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

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

It would be great to have Regex operator in filter. Consider the following example where I have some strings:

`"A, A B, B, B C", "A", "A B, C"`

I want to get all the strings that have `A`, with expected result : `"A, A B, B, B C", "A"`.

If we use `contains`, because of wildcards (`'%A%'`), it will give `"A, A B, B, B C", "A", "A B, C"` which is incorrect. If I use regex, then I can get the result as I would like it.
Also, if you support regex, we can indirectly get support for array columns as well (convert array as comma-separated column)

*Describe the solution you'd like:*

It would be great, if we can have a `regex` filter, which sets the passed regex to the passed column with the values.

Example:
```json
{
"member": "COLUMN",
"operator": "regex",
"values": [""]
}
```

This would eventually be resolved as `where REGEXP_CONTAINS(COLUMN, 'REGEX_PATTERN')`

*Describe alternatives you've considered*

Query through cube, to get all the column value, filter it after getting the resultset. But this approach, looses the cube (for logic purposes).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.