Skip to content

feat(table): add conditional formatting support for categorical columns - #37756

Open
sharmavikas18 wants to merge 4 commits into
apache:masterfrom
sharmavikas18:fix/conditional-formatting-categorical
Open

sharmavikas18 wants to merge 4 commits into
apache:masterfrom
sharmavikas18:fix/conditional-formatting-categorical

Conversation

@sharmavikas18

Copy link
Copy Markdown

Fixes #37678

SUMMARY

This PR enables conditional formatting for categorical columns (String and Boolean)
in both the Standard Table plugin and the AG Grid Table plugin.

Previously, categorical columns were blocked by control panel filtering logic,
even though the conditional formatting UI already supported categorical operators.

This change removes those restrictions and allows categorical columns to be used
in conditional formatting rules.

Changes made:

Standard Table plugin
File:
superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx

  • Removed the !hasTimeComparison restriction that prevented String and Boolean
    columns from appearing in the conditional formatting selector.
  • Updated description text from:
    "Apply conditional color formatting to numeric columns"
    to:
    "Apply conditional color formatting to columns".

AG Grid Table plugin
File:
superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx

  • Updated filtering logic to include:
    • GenericDataType.String
    • GenericDataType.Boolean
      in addition to GenericDataType.Numeric.
  • Updated description/label text for consistency.

User impact:

  • String columns now support operators like:
    equals, begins with, ends with, contains, not contains
  • Boolean columns now support operators like:
    is true, is false, is null, is not null

Technical notes:

  • Reused existing GenericDataType enum.
  • Minimal, targeted diff without structural refactoring.
  • Code formatted using Prettier.

All relevant tests passed (254 tests).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable.

TESTING INSTRUCTIONS

  1. Run Superset locally.
  2. Create or open a dataset containing:
    • String columns
    • Boolean columns
  3. Create a Table visualization (Standard Table or AG Grid Table).
  4. Open "Conditional Formatting".
  5. Verify that:
    • String columns appear in the column selector
    • Boolean columns appear in the column selector
  6. Add formatting rules using categorical operators.
  7. Confirm formatting applies correctly in the rendered table.

ADDITIONAL INFORMATION

  • Has associated issue: Fixes Custom Conditional Formatting for Categorical Columns #37678
  • 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

@bito-code-review

bito-code-review Bot commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #b05187

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: a9233f4..a9233f4
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables conditional formatting for categorical (String/Boolean) columns in the Standard Table and AG Grid Table plugins by broadening the conditional-formatting column filtering logic and updating control descriptions.

Changes:

  • Updated conditional formatting control description to be type-agnostic (“…to columns”) in both table plugins.
  • Expanded conditional-formatting column eligibility to include GenericDataType.String and GenericDataType.Boolean (previously numeric-only / time-compare gated).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx Broadens eligible conditional-formatting columns and updates help text.
superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx Broadens eligible conditional-formatting columns and updates help text.
Comments suppressed due to low confidence (2)

superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx:820

  • When hasTimeComparison is true, columnOptions is derived via processComparisonColumns(numericColumns, ...). Now that numericColumns includes String/Boolean, this path will (a) generate Main/#/△/% options for categorical columns that do not exist in transformProps, (b) drop the original categorical columns from the selector, and (c) lose dataType, causing the conditional-formatting UI to fall back to numeric operators. Consider splitting numeric vs categorical options: generate comparison options only for numeric columns (with dataType: Numeric), and include String/Boolean columns as-is so they remain selectable during time comparison.
                const numericColumns =
                  Array.isArray(colnames) && Array.isArray(coltypes)
                    ? colnames.reduce((acc, colname, index) => {
                        if (
                          coltypes[index] === GenericDataType.Numeric ||
                          coltypes[index] === GenericDataType.String ||
                          coltypes[index] === GenericDataType.Boolean
                        ) {
                          acc.push({
                            value: colname,
                            label: Array.isArray(verboseMap)
                              ? colname
                              : (verboseMap[colname] ?? colname),
                            dataType: coltypes[index],
                          });
                        }
                        return acc;
                      }, [])
                    : [];
                const columnOptions = hasTimeComparison
                  ? processComparisonColumns(
                      numericColumns || [],
                      ensureIsArray(timeCompareValue)[0]?.toString() || '',
                    )
                  : numericColumns;

superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx:739

  • In time comparison mode, processComparisonColumns(numericColumns, ...) will now receive String/Boolean columns too. That helper generates Main/#/△/% variants and omits dataType, which means categorical columns either disappear (originals not included) or show invalid comparison-prefixed options with numeric operators. Update the time-comparison branch to only expand numeric columns into comparison options (with dataType: Numeric) and keep categorical columns unchanged in columnOptions.
                const numericColumns =
                  Array.isArray(colnames) && Array.isArray(coltypes)
                    ? colnames
                        .filter(
                          (colname: string, index: number) =>
                            coltypes[index] === GenericDataType.Numeric ||
                            coltypes[index] === GenericDataType.String ||
                            coltypes[index] === GenericDataType.Boolean,
                        )
                        .map((colname: string) => ({
                          value: colname,
                          label: Array.isArray(verboseMap)
                            ? colname
                            : (verboseMap[colname] ?? colname),
                          dataType:
                            colnames && coltypes[colnames?.indexOf(colname)],
                        }))
                    : [];
                const columnOptions = hasTimeComparison
                  ? processComparisonColumns(
                      numericColumns || [],
                      ensureIsArray(timeCompareValue)[0]?.toString() || '',
                    )
                  : numericColumns;

@netlify

netlify Bot commented Feb 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

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

@bito-code-review

bito-code-review Bot commented Feb 8, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #446e9a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: a9233f4..14251b9
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - 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

@SBIN2010

SBIN2010 commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Superset uses Git pre-commit hooks courtesy of pre-commit. To install run the following:

pip3 install -r requirements/development.txt
pre-commit install
A series of checks will now run when you make a git commit.

Alternatively it is possible to run pre-commit by running pre-commit manually:

pre-commit run --all-files

rusackas pushed a commit that referenced this pull request Apr 17, 2026
- theming.mdx: document ECharts array property overrides (PR #37965) —
  array values like color palettes are fully supported and replaced entirely
  (not merged); adds Array Property Overrides section with color palette example
- configuring-superset.mdx: document PKCE support for database OAuth2
  (PR #37067) — add PKCE section under Custom OAuth2 with code_challenge_method
  config and when to use it
- cache.mdx: document ETag support for thumbnail/screenshot endpoints
  (PR #37663) — conditional GET with If-None-Match to avoid downloading
  unchanged images
- exploring-data.mdx: document SQL Lab UX improvements (PRs #37298, #37694,
  #37756) — treeview table browser, Ctrl+F find widget, resizable panels;
  also adds time range natural language expressions section (PR #37098)
- creating-your-first-dashboard.mdx: document Table chart features — boolean
  and categorical conditional formatting (PRs #36338, #37756), gradient toggle
  (PR #36280), HTML cell rendering with security note (PR #37685), column
  header tooltips from dataset descriptions (PR #37179), Display Controls
  modal in dashboard view (PR #36062)
- databases.json: update StarRocks supports_catalog and supports_dynamic_catalog
  to true — the engine spec (PR #37026) already implemented full catalog support
  with get_catalog_names(), get_default_catalog(), and SHOW CATALOGS; the
  committed JSON was stale and did not reflect this

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@harrystaley

Copy link
Copy Markdown

This feature needs to be included. Please add conditional formatting to categorical or boolean columns such as strings, etc.

@rusackas

Copy link
Copy Markdown
Member

Thanks @sharmavikas18, but I think this got superseded by #34330, which is why I closed the linked issue. Going to close this out, but holler if I'm mistakens or there's still a gap, and we can reopen/revisit this, no problem.

@rusackas rusackas closed this Jun 27, 2026
@rusackas rusackas reopened this Jun 27, 2026
@rusackas

Copy link
Copy Markdown
Member

Well... reopening. Feeling like I might have missed some subtlety there. Feel free to see if you agree or not with my prior statement. That said, this needs a rebase if it's going to merge and is indeed needed.

@rusackas

Copy link
Copy Markdown
Member

Attempting a rebase to see how this shakes out...

@rusackas
rusackas force-pushed the fix/conditional-formatting-categorical branch from 14251b9 to cdd8ead Compare June 27, 2026 09:10
@pull-request-size pull-request-size Bot added size/S and removed size/L labels Jun 27, 2026
@codecov

codecov Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.62%. Comparing base (2350348) to head (cea804d).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...ns/plugin-chart-ag-grid-table/src/controlPanel.tsx 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #37756      +/-   ##
==========================================
- Coverage   84.63%   84.62%   -0.01%     
==========================================
  Files        3069     3069              
  Lines      205446   205449       +3     
  Branches    48306    48310       +4     
==========================================
- Hits       173879   173870       -9     
- Misses      28277    28285       +8     
- Partials     3290     3294       +4     
Flag Coverage Δ
hive 34.53% <ø> (ø)
javascript 80.81% <90.90%> (+<0.01%) ⬆️
mysql 52.55% <ø> (ø)
postgres ?
presto 36.26% <ø> (ø)
python 87.72% <ø> (-0.02%) ⬇️
sqlite 52.32% <ø> (ø)
unit 82.45% <ø> (ø)

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.

@bito-code-review

bito-code-review Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #db6f05

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 7302466..cdd8ead
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - 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

@sharmavikas18

Copy link
Copy Markdown
Author

@rusackas let me know if you need me to make any changes

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Sep 9, 2026
@rusackas

Copy link
Copy Markdown
Member

Confirmed #34330 didn't cover this — master still blocks String/Boolean columns from conditional formatting under time comparison. Just needs a rebase to land.

@rusackas
rusackas force-pushed the fix/conditional-formatting-categorical branch from cdd8ead to 6af3615 Compare September 29, 2026 16:32
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Sep 29, 2026
@github-actions github-actions Bot added risk:chart-metadata and removed requires:rebase Requires rebasing on top of current master labels Sep 29, 2026

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #3f5d00

Actionable Suggestions - 1
  • superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx - 1
Review Details
  • Files reviewed - 2 · Commit Range: 8b8be67..6af3615
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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

Comment on lines 884 to 891
? colnames
.filter(
(colname: string, index: number) =>
coltypes[index] === GenericDataType.Numeric,
)
.map((colname: string) => ({
.map((colname: string, index: number) => ({
value: colname,
label: Array.isArray(verboseMap)
? colname
: (verboseMap?.[colname] ?? colname),
// Every entry here already passed the Numeric filter
// above, so the type is always Numeric — no need to
// re-look it up (which breaks on duplicate colnames).
dataType: GenericDataType.Numeric,
dataType: coltypes[index],
}))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated column mapping

The new eligibleColumns map (884-891) duplicates the identical colnames.map(...) mapping already in allColumns (866-872). Two parallel mappings in the same mapStateToProps can silently diverge when one is updated. Consider a shared helper or deriving eligibleColumns from allColumns (minus the ENTIRE_ROW entry) before filtering by type.

Code Review Run #3f5d00


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@rusackas

Copy link
Copy Markdown
Member

Looks like there are still issues with CI. messages.pot is out of sync (need to run ./scripts/translations/babel_update.sh and commit the diff), and the ag-grid-table controlPanel.test.tsx test around numericColumns/dataType resolution is now failing since the eligibility filter changed.

I'll see if I can help move this forward again, but please feel free to jump in and/or revert my commits if you'd rather tackle things yourself, @sharmavikas18.

The categorical-formatting change reworded the conditional-formatting
description string without regenerating messages.pot, failing
babel-extract's drift check. It also changed eligibleColumns to
include String/Boolean columns alongside Numeric ones when there is
no time comparison, which the duplicate-colname regression test
hadn't been updated to expect.

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the i18n Namespace | Anything related to localization label Sep 30, 2026
@bito-code-review

bito-code-review Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #6011bd

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 6af3615..193633b
    • superset-frontend/plugins/plugin-chart-ag-grid-table/test/controlPanel.test.tsx
    • superset/translations/messages.pot
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: cea804d445be

This branch has not been deployed

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

Labels

i18n Namespace | Anything related to localization plugins risk:chart-metadata size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Conditional Formatting for Categorical Columns

5 participants