-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Don't offer drill-throughs when top-level column doesn't exist #66907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
e2e tests failed on
|
| File | Test Name |
|---|---|
dashboardsAndQuestions.cy.spec.ts |
Cache invalidation for dashboards and questions > ee > adaptive and duration strategies > questions can use duration strategy |
embed-flow-enable-embed-js.cy.spec.ts |
scenarios > embedding > sdk iframe embed setup > enable embed js > ee > shows the Enable to Continue button and enables embedding on click |
embed-options.cy.spec.ts |
scenarios > embedding > sdk iframe embed options passthrough > shows a static question with drills=false |
| pivots (into {} (for [pivot-type breakout-pivot-types | ||
| :let [pred (get pivot-type-predicates pivot-type) | ||
| columns (pivot-drill-pred query stage-number context pred)] | ||
| :when (not-empty columns)] | ||
| :let [pred (get pivot-type-predicates pivot-type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The :let and :when keywords in the for comprehension should be aligned consistently. According to the Metabase Clojure style, when using for bindings, the binding clauses should be vertically aligned.
Consider:
| pivots (into {} (for [pivot-type breakout-pivot-types | |
| :let [pred (get pivot-type-predicates pivot-type) | |
| columns (pivot-drill-pred query stage-number context pred)] | |
| :when (not-empty columns)] | |
| :let [pred (get pivot-type-predicates pivot-type) | |
| pivots (into {} (for [pivot-type breakout-pivot-types | |
| :let [pred (get pivot-type-predicates pivot-type) | |
| columns (pivot-drill-pred query stage-number context pred)] | |
| :when (not-empty columns)] |
The extra spaces after :let and :when are inconsistent with standard formatting where keywords should have consistent spacing.
The summary: we are offering drill-throughs on custom columns defined after aggregation, but those custom columns don't exist in the base query. The error presented in such a way that `lib.underlying/top-level-column` for a dimension was returning `nil`, and we were happily putting that `nil` into the query we constructed. I created a utility to filter dimensions by whether or not the top-level-column can be resolved, and used this for the underlying-records drill-through (from the original issue) as well as the pivot drill-through (which behaved similarly). If no dimensions have a top-level column, the drill-through is not available. If some do, we offer the partial drill-through.
Code Review SummaryI've reviewed the Clojure code changes in this PR. The implementation looks solid and addresses issue #66715 correctly by filtering out dimensions that can't be traced back to the top-level query. Style Issues Found:
Implementation Notes:✅ The new traceable-dimensions function is well-designed and properly documented The solution appropriately addresses the root cause by preventing drill-throughs when dimensions reference columns that don't exist in the top-level query, rather than allowing them and showing an error. |
The summary: we are offering drill-throughs on custom columns defined after aggregation, but those custom columns don't exist in the base query. The error presented in such a way that `lib.underlying/top-level-column` for a dimension was returning `nil`, and we were happily putting that `nil` into the query we constructed. I created a utility to filter dimensions by whether or not the top-level-column can be resolved, and used this for the underlying-records drill-through (from the original issue) as well as the pivot drill-through (which behaved similarly). If no dimensions have a top-level column, the drill-through is not available. If some do, we offer the partial drill-through.
… (#66986) The summary: we are offering drill-throughs on custom columns defined after aggregation, but those custom columns don't exist in the base query. The error presented in such a way that `lib.underlying/top-level-column` for a dimension was returning `nil`, and we were happily putting that `nil` into the query we constructed. I created a utility to filter dimensions by whether or not the top-level-column can be resolved, and used this for the underlying-records drill-through (from the original issue) as well as the pivot drill-through (which behaved similarly). If no dimensions have a top-level column, the drill-through is not available. If some do, we offer the partial drill-through. Co-authored-by: Timothy S. Dean <timothy.dean@metabase.com>
… (#66987) The summary: we are offering drill-throughs on custom columns defined after aggregation, but those custom columns don't exist in the base query. The error presented in such a way that `lib.underlying/top-level-column` for a dimension was returning `nil`, and we were happily putting that `nil` into the query we constructed. I created a utility to filter dimensions by whether or not the top-level-column can be resolved, and used this for the underlying-records drill-through (from the original issue) as well as the pivot drill-through (which behaved similarly). If no dimensions have a top-level column, the drill-through is not available. If some do, we offer the partial drill-through. Co-authored-by: Timothy S. Dean <timothy.dean@metabase.com>
Closes #66715
Description
The issue is well-documented. The summary: we are offering drill-throughs on custom columns defined after aggregation, but those custom columns don't exist in the base query.
I see three options:
Option 3 was suggested by @alexyarosh on #66715, and it's the one I went with here. The error presented in such a way that
lib.underlying/top-level-columnfor a dimension was returningnil, and we were happily putting thatnilinto the query we constructed.I created a utility to filter dimensions by whether or not the top-level-column can be resolved, and used this for the underlying-records drill-through (from the original issue) as well as the pivot drill-through (which behaved similarly). If no dimensions have a top-level column, the drill-through is not available. If some do, we offer the partial drill-through.
How to verify
Copied from the issue:
For an artisanal handcrafted version:
Demo
Loom
Checklist