You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/09/22 01:27:57 UTC

(superset) branch master updated: fix(chart-controls): keep axis sort available for columns with unknown type (#44344)

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

rusackas 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 7eb9532c0ba fix(chart-controls): keep axis sort available for columns with unknown type (#44344)
7eb9532c0ba is described below

commit 7eb9532c0ba2410e25cfd31e51ce19a38d4c5ed4
Author: Konstantin Khlopkov <47...@users.noreply.github.com>
AuthorDate: Tue Sep 22 04:27:49 2026 +0300

    fix(chart-controls): keep axis sort available for columns with unknown type (#44344)
---
 .../superset-ui-chart-controls/src/utils/isSortable.ts         | 10 ++++++++++
 .../superset-ui-chart-controls/test/utils/isSortable.test.ts   |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/utils/isSortable.ts b/superset-frontend/packages/superset-ui-chart-controls/src/utils/isSortable.ts
index 7de415a03b5..618977f6641 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/utils/isSortable.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/utils/isSortable.ts
@@ -39,9 +39,19 @@ export function isSortable(controls: ControlStateMapping): boolean {
   // user to provide a sortable result.
   const isCustomSQL = !isPhysicalColumn(xAxisValue);
 
+  // Same reasoning applies to a physical column whose type could not be
+  // resolved to a generic type: sorting categories by a metric stays valid,
+  // so the sort control must not silently disappear for such columns.
+  const isUnknownType = !checkColumnType(
+    getColumnLabel(xAxisValue),
+    controls?.datasource?.datasource,
+    [GenericDataType.String, GenericDataType.Boolean, GenericDataType.Numeric],
+  );
+
   return (
     isForcedCategorical ||
     isCustomSQL ||
+    (isPhysicalColumn(xAxisValue) && isUnknownType) ||
     checkColumnType(
       getColumnLabel(xAxisValue),
       controls?.datasource?.datasource,
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/isSortable.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/utils/isSortable.test.ts
index 8c58aba3294..a1044ea4bd8 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/isSortable.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/isSortable.test.ts
@@ -27,6 +27,7 @@ const controls: ControlStateMapping = {
         { column_name: 'a', type_generic: GenericDataType.String },
         { column_name: 'b', type_generic: GenericDataType.Numeric },
         { column_name: 'c', type_generic: GenericDataType.Boolean },
+        { column_name: 'u', type_generic: undefined },
       ],
     },
     type: 'Select',
@@ -68,3 +69,11 @@ test('should return false if none of the conditions are met', () => {
   };
   expect(isSortable(c)).toBe(false);
 });
+
+test('should return true for a column whose type is unknown', () => {
+  const c: ControlStateMapping = {
+    ...controls,
+    x_axis: { value: 'u', type: 'Select' },
+  };
+  expect(isSortable(c)).toBe(true);
+});