Skip to content

fix(explore): honor column Label in filter search and pill - #43404

Open
sadpandajoe wants to merge 3 commits into
masterfrom
fix-explore-filter-label-search
Open

fix(explore): honor column Label in filter search and pill#43404
sadpandajoe wants to merge 3 commits into
masterfrom
fix-explore-filter-label-search

Conversation

@sadpandajoe

@sadpandajoe sadpandajoe commented Aug 21, 2026

Copy link
Copy Markdown
Member

SUMMARY

When a dataset column has a display Label (verbose_name) set, the Explore filter
control had two related display bugs:

  • The filter column-picker's search box only matched the technical column name, not
    the Label, so searching for the Label text returned no results.
  • After selecting a column by its Label, the saved filter pill showed the technical
    column name instead of the Label — inconsistent with the Metrics control in the
    same panel, which already displays the Label correctly for the same column.

The generated SQL and query results were already correct in both cases; this change
is a display/search-matching fix only. Both fixes mirror the existing, working
implementation already used by the Metrics control for the same column metadata.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: searching a filter column by its Label returns no match; a saved filter pill
for a labeled column shows the technical column name (e.g. num > 500).

before.mp4

After: searching by Label matches the column; the saved filter pill shows the Label
(e.g. total_count > 500), matching how the Metrics control already displays it.
Evidence to follow as a comment on this PR.

after.mp4

TESTING INSTRUCTIONS

  1. Edit a dataset column to set a display Label different from its technical name
    (e.g. the birth_names dataset's num column, Label total_count).
  2. Open a chart built from that dataset in Explore and add a filter.
  3. In the filter column-picker, search using the Label text — the column now appears
    in the results (previously it did not).
  4. Select the column, set an operator and value, and save the filter.
  5. Confirm the filter pill displays the Label (e.g. total_count > 500) rather than
    the technical column name.
  6. Open the filter's Custom SQL tab and confirm it still shows the technical column
    name (e.g. num > 500) — the underlying query is unaffected by this change.
  7. Repeat with a column that has no Label set and confirm search/display continue to
    use the technical column name exactly as before.

Automated coverage: AdhocFilterEditPopoverSimpleTabContent.test.tsx,
AdhocFilter.test.ts, AdhocFilterOption.test.tsx, DndFilterSelect.test.tsx.

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

The Explore filter control's column-picker searched only column_name,
so a column with a verbose_name (display Label) set could not be found
by typing its Label text, even though the Metrics control in the same
panel already supports this via optionFilterProps.

Add column_name and verbose_name to each subject option and set
optionFilterProps accordingly, mirroring the pattern already used by
AdhocMetricEditPopover's column select.
A saved filter's pill/clause label was built from translateToSql(),
which always renders the technical subject (column_name), so a column
with a verbose_name set showed its technical name on the pill instead
of the Label -- unlike the Metrics control, which already prefers
verbose_name for its default label.

Let translateToSql optionally resolve a matching column's verbose_name
for display, and pass the available columns through
AdhocFilter.getDefaultLabel() from both pill renderers. The SQL/query
path (translateToSql() called with no columns, e.g. the Custom SQL tab
and getTooltipTitle()) is unchanged and still resolves to the
technical column name.
The prior test coverage for the pill-label fix asserted
AdhocFilter.getDefaultLabel() directly but never rendered the actual
components that call it, so reverting the getDefaultLabel(options)
call at either renderer call site would leave every test green.

Add a render-level assertion for both AdhocFilterOption and
DndFilterSelect (which renders DndAdhocFilterOption) that a column
with a verbose_name shows that label on the rendered pill, closing the
gap at the layer where the bug is user-visible.
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 9b675c5
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a88a82b51593900096eea6b
😎 Deploy Preview https://deploy-preview-43404--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.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.74%. Comparing base (b5fe00b) to head (9b675c5).
⚠️ Report is 31 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #43404   +/-   ##
=======================================
  Coverage   66.74%   66.74%           
=======================================
  Files        2876     2876           
  Lines      164228   164238   +10     
  Branches    37891    37898    +7     
=======================================
+ Hits       109617   109625    +8     
- Misses      52453    52455    +2     
  Partials     2158     2158           
Flag Coverage Δ
javascript 74.05% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@sadpandajoe
sadpandajoe requested review from aminghadersohi and rusackas and removed request for aminghadersohi August 21, 2026 22:40
@sadpandajoe
sadpandajoe marked this pull request as ready for review August 21, 2026 22:40
@dosubot dosubot Bot added change:frontend Requires changing the frontend explore:filter Related to filters in Explore labels Aug 21, 2026
@bito-code-review

bito-code-review Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2c70e7

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx - 1
Review Details
  • Files reviewed - 9 · Commit Range: 9488f1c..9b675c5
    • superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx
    • superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx
    • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilter/AdhocFilter.test.ts
    • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilter/index.ts
    • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/AdhocFilterEditPopoverSimpleTabContent.test.tsx
    • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx
    • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx
    • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/index.tsx
    • superset-frontend/src/explore/components/controls/FilterControl/utils/translateToSQL.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

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

Labels

change:frontend Requires changing the frontend explore:filter Related to filters in Explore size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant