-
- Downloads
Convert simple filter with case-insensitive string function (#18374)
This is more of a quick workaround (read: hack) until we have a better parsing infrastructure. The idea is to have an extra argument to contains/startsWith/endsWith, which will be "case-insensitive" if the comparison is to be carred out by ignoring the case. If this extra argument wasn't specified, then it'll be assumed that the case-sensitive comparison is intended. IOW, this MBQL `["contains", X, Y`] or `["contains", X, Y, {case-sensitive: true}]` will be equivalent to the user-visible custom expression `CONTAINS(X)`. Meanwhile, MBQL `["contains", X, Y, {case-sensitive: false}]` will be mapped to the user-visible custom expresson `CONTAINS(X, Y, "case-insensitive")`. With this, we achieve a lossless conversion for 3 string functions (contains, startsWith, endsWith) when involving case-sensitivity.
Showing
- frontend/src/metabase/lib/expressions/compile.js 17 additions, 2 deletionsfrontend/src/metabase/lib/expressions/compile.js
- frontend/src/metabase/lib/expressions/config.js 3 additions, 0 deletionsfrontend/src/metabase/lib/expressions/config.js
- frontend/src/metabase/lib/expressions/format.js 14 additions, 2 deletionsfrontend/src/metabase/lib/expressions/format.js
- frontend/src/metabase/lib/expressions/typechecker.js 24 additions, 18 deletionsfrontend/src/metabase/lib/expressions/typechecker.js
- frontend/test/metabase/lib/expressions/typechecker.unit.spec.js 7 additions, 2 deletions...nd/test/metabase/lib/expressions/typechecker.unit.spec.js
- frontend/test/metabase/scenarios/question/filter.cy.spec.js 4 additions, 4 deletionsfrontend/test/metabase/scenarios/question/filter.cy.spec.js
Loading
Please register or sign in to comment