-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* source-field populated in aggregates with foreign refs When aggregates are populated that reference other tables, either a `:source-field` must be provided in the field metadata or a `:join-alias` needs to be provided. The former is preferred. Prior to this PR, the first situation in the below simplified case could happen: ```clojure ;;Simplified case ;; busted (qp/process-query {:database 1, ;; 59 is "PRODUCTS" -> "PRICE" which is not in the "REVIEWS" table :query {:aggregation [["sum" ["field" 59 {:base-type "type/Float"}]]] ;; "REVIEWS" :source-table 8}, :type "query"}) ; Works (qp/process-query {:database 1, ;; The `:source-field` metadata fixes the above query :query {:aggregation [["sum" ["field" 59 {:base-type "type/Float" ;; "REVIEWS" -> "PRODUCT_ID" :source-field 71}]]] :source-table 8}, :type "query"}) ``` This PR updates `metabase.automagic-dashboards.interestin/ground-metric` to use the `->reference` function for fields when building the `decoder` for transforming field names to references, which properly adds sources for external fields. Fixes #38618 * Updating `grounded-metrics-test` to reflect updated field referencing. Co-authored-by: Mark Bastian <markbastian@gmail.com>
- Loading branch information
1 parent
3d86160
commit 1730e3d
Showing
3 changed files
with
110 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters