This is an automated email from the ASF dual-hosted git repository.

richardfogaca pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 89a98ab9a42 fix(dataset-editor): include calculated columns in 
currency code dropdown (#37621)
89a98ab9a42 is described below

commit 89a98ab9a429af35cb29175173153b4d80b45b70
Author: Richard Fogaca Nienkotter 
<[email protected]>
AuthorDate: Wed Feb 4 11:17:07 2026 -0300

    fix(dataset-editor): include calculated columns in currency code dropdown 
(#37621)
---
 .../DatasourceEditor/DatasourceEditor.jsx          |  8 +++--
 .../tests/DatasourceEditorCurrency.test.tsx        | 38 +++++++++++++++++++---
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git 
a/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
 
b/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
index 1d4480f11b3..4895f632f0e 100644
--- 
a/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
+++ 
b/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx
@@ -1122,9 +1122,13 @@ class DatasourceEditor extends PureComponent {
         label: col.verbose_name || col.column_name,
       }));
 
-    // Get string-type columns for the currency code dropdown
+    // String columns + untyped calculated columns for the currency code 
dropdown
     const stringColumns = allColumns
-      .filter(col => col.type_generic === GenericDataType.String)
+      .filter(
+        col =>
+          col.type_generic === GenericDataType.String ||
+          (col.expression && col.type_generic == null),
+      )
       .map(col => ({
         value: col.column_name,
         label: col.verbose_name || col.column_name,
diff --git 
a/superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.tsx
 
b/superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.tsx
index 445a47b087f..6efa680965b 100644
--- 
a/superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.tsx
+++ 
b/superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.tsx
@@ -138,7 +138,7 @@ test('changes currency symbol from USD to GBP', async () => 
{
   expect(updatedMetric?.currency?.symbolPosition).toBe('prefix');
 }, 60000);
 
-test('currency code column dropdown shows only string columns', async () => {
+test('currency code column dropdown shows string and untyped calculated 
columns but excludes numeric and typed non-string calculated columns', async () 
=> {
   const baseProps = createProps();
   const testProps = {
     ...baseProps,
@@ -167,6 +167,28 @@ test('currency code column dropdown shows only string 
columns', async () => {
           groupby: false,
           column_name: 'amount',
         },
+        {
+          id: 102,
+          type: '',
+          type_generic: null,
+          filterable: true,
+          is_dttm: false,
+          is_active: true,
+          expression: "CASE WHEN country = 'US' THEN 'USD' ELSE 'EUR' END",
+          groupby: true,
+          column_name: 'derived_currency',
+        },
+        {
+          id: 103,
+          type: 'NUMERIC',
+          type_generic: GenericDataType.Numeric,
+          filterable: true,
+          is_dttm: false,
+          is_active: true,
+          expression: 'price * quantity',
+          groupby: false,
+          column_name: 'total_amount',
+        },
         ...baseProps.datasource.columns,
       ],
     },
@@ -196,10 +218,16 @@ test('currency code column dropdown shows only string 
columns', async () => {
     expect(currencyCodeOption).toBeDefined();
   });
 
-  // Verify NUMERIC column is NOT available
+  // Verify CALCULATED column is available despite null type_generic
   const options = document.querySelectorAll('.ant-select-item-option');
-  const amountOption = Array.from(options).find(o =>
-    o.textContent?.includes('amount'),
+  const derivedCurrencyOption = Array.from(options).find(o =>
+    o.textContent?.includes('derived_currency'),
+  );
+  expect(derivedCurrencyOption).toBeDefined();
+
+  // Verify NUMERIC columns (physical and calculated) are NOT available
+  const numericOptions = Array.from(options).filter(o =>
+    ['amount', 'total_amount'].includes(o.textContent?.trim() ?? ''),
   );
-  expect(amountOption).toBeUndefined();
+  expect(numericOptions).toHaveLength(0);
 }, 60000);

Reply via email to