Skip to content

fix(drill-to-detail): drill to detail by correctly filtering by metric#39766

Open
luizotavio32 wants to merge 1 commit intoapache:masterfrom
luizotavio32:fix-drill-to-detail-by
Open

fix(drill-to-detail): drill to detail by correctly filtering by metric#39766
luizotavio32 wants to merge 1 commit intoapache:masterfrom
luizotavio32:fix-drill-to-detail-by

Conversation

@luizotavio32
Copy link
Copy Markdown
Contributor

@luizotavio32 luizotavio32 commented Apr 30, 2026

SUMMARY

When a chart has a column whose verbose_name differs from its physical column_name (e.g. column case_owner displayed as Case Owner), right-clicking a bar and selecting Drill to detail by Case Owner sends a filter {col: "Case Owner", op: "==", val: "..."} in the samples request.

get_sqla_query builds columns_by_name keyed exclusively by physical column_name, so the lookup columns_by_name.get("Case Owner") returns None. With neither col_obj nor sqla_col set, the filter is silently skipped — no WHERE clause is generated and the drill returns the full unfiltered dataset.

Root cause

get_sqla_query (superset/models/helpers.py) resolves filter columns only by physical name. There is no fallback for the case where a chart plugin sends the column's verbose_name as the filter column — which is what the echarts context-menu handler does when groupby contains a column whose displayed label is the verbose name.

Fix

After the physical-name lookup fails, fall back to matching verbose_name across self.columns before continuing to the metric-filter path. The resolution order becomes: physical column_nameverbose_name → metric name.

TESTING INSTRUCTIONS

  1. Create or open a dataset that has a column with a verbose_name set (e.g. column case_owner, verbose name Case Owner).
  2. Build a bar chart using that column as the groupby dimension with at least one metric.
  3. On a dashboard, right-click a bar and choose Drill to detail by <verbose label>.
  4. Confirm the modal opens with the filter tag showing and the rows are correctly filtered to only that dimension value.
  5. Confirm Drill to detail (no filter) still returns the full unfiltered dataset.
  6. Confirm Drill to detail by all (multiple filters) still works.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 71e61e4
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69f2acd96348280008e603b0
😎 Deploy Preview https://deploy-preview-39766--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@luizotavio32 luizotavio32 changed the title fix: drill to detail by correctly filtering by metric fix(drill-to-detail): drill to detail by correctly filtering by metric Apr 30, 2026
@luizotavio32 luizotavio32 marked this pull request as ready for review April 30, 2026 01:16
@dosubot dosubot Bot added change:backend Requires changing the backend dashboard:drill-to-detail labels Apr 30, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.41%. Comparing base (c2b9272) to head (71e61e4).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39766   +/-   ##
=======================================
  Coverage   64.41%   64.41%           
=======================================
  Files        2566     2566           
  Lines      134284   134286    +2     
  Branches    31194    31195    +1     
=======================================
+ Hits        86503    86505    +2     
  Misses      46283    46283           
  Partials     1498     1498           
Flag Coverage Δ
hive 39.70% <0.00%> (-0.01%) ⬇️
mysql 60.04% <100.00%> (+<0.01%) ⬆️
postgres 60.12% <100.00%> (+<0.01%) ⬆️
presto 41.46% <0.00%> (-0.01%) ⬇️
python 61.68% <100.00%> (+<0.01%) ⬆️
sqlite 59.76% <100.00%> (+<0.01%) ⬆️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant