[MLv2] Support `:case` expressions in aggregations (#31088)
Fixes #29935. Part of the issue here was incorrect hand-rolling of the second argument to `:case`, the default value. In the failing test case given in #29935, it was written as `{:default 0}`. But that's accidentally transferring for legacy MBQL works, where the default is an option and the options come last rather than first in a clause. This also fixes `lib.common/->op-arg` to make sure it recurses properly. It wasn't recursing into lists or MBQL clauses, which left unresolved `(fn [query stage] ...)` functions in eg. `:case` alternatives, since those are nested inside lists.
Showing
- src/metabase/lib/common.cljc 11 additions, 2 deletionssrc/metabase/lib/common.cljc
- test/metabase/lib/aggregation_test.cljc 40 additions, 0 deletionstest/metabase/lib/aggregation_test.cljc
- test/metabase/query_processor_test/test_mlv2.clj 1 addition, 7 deletionstest/metabase/query_processor_test/test_mlv2.clj
Please register or sign in to comment