-
- Downloads
Modify `:contains`, `:starts-with` and `:ends-with` so field or expression can...
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:
metamben <103100869+metamben@users.noreply.github.com>
Showing
- modules/drivers/druid/src/metabase/driver/druid/query_processor.clj 26 additions, 14 deletions...ivers/druid/src/metabase/driver/druid/query_processor.clj
- modules/drivers/mongo/src/metabase/driver/mongo/query_processor.clj 19 additions, 11 deletions...ivers/mongo/src/metabase/driver/mongo/query_processor.clj
- modules/drivers/mongo/test/metabase/driver/mongo/parameters_test.clj 30 additions, 8 deletions...vers/mongo/test/metabase/driver/mongo/parameters_test.clj
- modules/drivers/mongo/test/metabase/driver/mongo/query_processor_test.clj 20 additions, 2 deletions...mongo/test/metabase/driver/mongo/query_processor_test.clj
- src/metabase/driver/sql/query_processor.clj 31 additions, 23 deletionssrc/metabase/driver/sql/query_processor.clj
- test/metabase/query_processor_test/filter_test.clj 63 additions, 5 deletionstest/metabase/query_processor_test/filter_test.clj
Loading
Please register or sign in to comment