Skip to content

Conversation

@richardfogaca
Copy link
Contributor

@richardfogaca richardfogaca commented Feb 3, 2026

SUMMARY

The Currency code column dropdown in the Dataset Editor excludes calculated columns, even though they are valid choices for currency code mapping (e.g. a CASE statement that maps country values to ISO currency codes like USD, EUR).

Root cause: The dropdown is built from allColumns (physical + calculated), but the filter at DatasourceEditor.jsx:1096 requires type_generic === GenericDataType.String. The backend's fetch_metadata() only resolves type_generic for physical columns — calculated columns are added back to the dataset with type_generic unset (null/undefined), so they silently fail the strict equality check.

Fix: Loosen the filter to also include columns with a truthy expression property (the same signal the component already uses to distinguish calculated from physical columns at construction time). This is safe because the downstream currency detection logic already handles invalid currency codes gracefully by falling back to neutral formatting.

 const stringColumns = allColumns
-  .filter(col => col.type_generic === GenericDataType.String)
+  .filter(
+    col => col.type_generic === GenericDataType.String || col.expression,
+  )

Fixes #37620

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before — calculated column num_california is missing from the dropdown:
before

After — calculated column num_california now appears in the dropdown:
after

TESTING INSTRUCTIONS

  1. Open a dataset in the Dataset Editor (e.g. birth_names)
  2. Go to the Calculated columns tab and verify a calculated column exists (or add one, e.g. CASE WHEN state = 'CA' THEN 'USD' ELSE 'EUR' END)
  3. In the Default Column Settings section at the top, open the Currency code column dropdown
  4. Verify the calculated column appears in the dropdown alongside the physical string columns
  5. Verify numeric physical columns (e.g. num, num_boys) do not appear
  6. Select the calculated column and click Save — verify it persists

Unit tests:

npm run test -- --testPathPatterns='DatasourceEditorCurrency' --no-coverage

ADDITIONAL INFORMATION

…down

The currency code column dropdown in the Dataset Editor only showed
physical columns with type_generic === String, which excluded calculated
columns because the backend does not resolve type metadata for them.
Loosen the filter to also include columns with a truthy expression,
so calculated columns (e.g. CASE statements mapping countries to
currency codes) appear in the dropdown.
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 3, 2026

Code Review Agent Run #1c4f0f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 4e3da4e..4e3da4e
    • superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
    • superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Feb 3, 2026
@codeant-ai-for-open-source
Copy link
Contributor

Sequence Diagram

Shows the fix where the Dataset Editor includes calculated columns (identified by a truthy expression) when building the currency code dropdown, despite those columns lacking backend-resolved type metadata.

sequenceDiagram
    participant DatasetEditor
    participant Backend
    participant Dropdown
    participant User

    DatasetEditor->>Backend: fetch_metadata()
    Backend-->>DatasetEditor: columns (physical cols have type_generic; calculated cols lack type_generic but include expression)
    DatasetEditor->>Dropdown: Build options filtered by (type_generic == String OR expression)
    Dropdown-->>User: Render currency code list (includes calculated columns)
Loading

Generated by CodeAnt AI

@netlify
Copy link

netlify bot commented Feb 3, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4e3da4e
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6981540c7fe953000792b4ee
😎 Deploy Preview https://deploy-preview-37621--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

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 size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(dataset-editor): Calculated columns excluded from Currency Code column dropdown

1 participant