Skip to content
Snippets Groups Projects
user avatar
lbrdnk authored
Modify `:contains`, `:starts-with` and `:ends-with` so field or expression can be used as the second argument (#32446)

* Update `LIKE` to handle fields and expressions

Previously only string could be used with like clause, ie. as second
argument of `:starts-with`, `:ends-with` or `:contains`. This commit modifies
translation of those functions, so fields or expressions can be
used in place of second argument.

* Make only expression or field args use `concat`

Using concat with values unnecessarily complects generated sql.

* Update tests

* Extend mongo string matching capabilities

Make mongo filter compilation use `$regexMatch` for `:contains`,
`:starts-with` and `:ends-with` so expressions and fields
can be matched against.

* Adjust mongo specific tests

* Update druid

Druid's filters work with `:contains`, `:starts-with` and `:ends-with`,
but only if second argument is literal pattern. This commit updates
existing code, so expection is thrown if `pattern` has different form
than `[:value ...]`.

* Address review comments - sql

* Address review comments - mongo

* Use mbql `:concat` instead of `hx/call :concat`

Vertica, orcacle and sqlite handle concat differently than other
drivers. To overcome this limitation, `pre`, `post` and `arg` are
wrapped into mbql's concat expression which is then translated
with regards to the specifics of particular driver.

* Update according to the review feedback

---------

Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
a98bfa1f
History
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Name Last commit Last update
..
drivers