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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3f86006062b fix: Web console: sorting on columns whose accessor 
returns an object (#20419)
3f86006062b is described below

commit 3f86006062b809e9eee6d3156c94aede10cf7390
Author: Vadim Ogievetsky <[email protected]>
AuthorDate: Thu Sep 24 15:37:07 2026 -0700

    fix: Web console: sorting on columns whose accessor returns an object 
(#20419)
    
    * Fix supervisor table order by
    
    * Fix counter sort issue
---
 .../__snapshots__/supervisor-statistics-table.spec.tsx.snap      | 7 +++++++
 .../supervisor-statistics-table/supervisor-statistics-table.tsx  | 9 +++++++++
 .../execution-stages-pane/execution-stages-pane.tsx              | 3 +++
 3 files changed, 19 insertions(+)

diff --git 
a/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/__snapshots__/supervisor-statistics-table.spec.tsx.snap
 
b/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/__snapshots__/supervisor-statistics-table.spec.tsx.snap
index eed264f3e70..6c8dd66689b 100644
--- 
a/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/__snapshots__/supervisor-statistics-table.spec.tsx.snap
+++ 
b/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/__snapshots__/supervisor-statistics-table.spec.tsx.snap
@@ -96,6 +96,7 @@ exports[`SupervisorStatisticsTable matches snapshot on error 
1`] = `
             "accessor": "rowStats.totals.buildSegments",
             "className": "padded",
             "id": "total",
+            "sortMethod": [Function],
             "width": 200,
           },
         ]
@@ -279,6 +280,7 @@ exports[`SupervisorStatisticsTable matches snapshot on init 
1`] = `
             "accessor": "rowStats.totals.buildSegments",
             "className": "padded",
             "id": "total",
+            "sortMethod": [Function],
             "width": 200,
           },
         ]
@@ -488,6 +490,7 @@ exports[`SupervisorStatisticsTable matches snapshot on no 
data 1`] = `
             "accessor": "rowStats.totals.buildSegments",
             "className": "padded",
             "id": "total",
+            "sortMethod": [Function],
             "width": 200,
           },
         ]
@@ -671,6 +674,7 @@ exports[`SupervisorStatisticsTable matches snapshot on some 
data 1`] = `
             "accessor": "rowStats.totals.buildSegments",
             "className": "padded",
             "id": "total",
+            "sortMethod": [Function],
             "width": 200,
           },
           {
@@ -679,6 +683,7 @@ exports[`SupervisorStatisticsTable matches snapshot on some 
data 1`] = `
             "accessor": "rowStats.movingAverages.buildSegments.1m",
             "className": "padded",
             "id": "1m",
+            "sortMethod": [Function],
             "width": 200,
           },
           {
@@ -687,6 +692,7 @@ exports[`SupervisorStatisticsTable matches snapshot on some 
data 1`] = `
             "accessor": "rowStats.movingAverages.buildSegments.5m",
             "className": "padded",
             "id": "5m",
+            "sortMethod": [Function],
             "width": 200,
           },
           {
@@ -695,6 +701,7 @@ exports[`SupervisorStatisticsTable matches snapshot on some 
data 1`] = `
             "accessor": "rowStats.movingAverages.buildSegments.15m",
             "className": "padded",
             "id": "15m",
+            "sortMethod": [Function],
             "width": 200,
           },
         ]
diff --git 
a/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/supervisor-statistics-table.tsx
 
b/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/supervisor-statistics-table.tsx
index a3e5ceab43f..41109bf7a0e 100644
--- 
a/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/supervisor-statistics-table.tsx
+++ 
b/web-console/src/dialogs/supervisor-table-action-dialog/supervisor-statistics-table/supervisor-statistics-table.tsx
@@ -44,6 +44,13 @@ export function normalizeSupervisorStatisticsResults(
   );
 }
 
+function sortByProcessedBytes(
+  a: RowStatsCounter | undefined,
+  b: RowStatsCounter | undefined,
+): number {
+  return Number(a?.processedBytes || 0) - Number(b?.processedBytes || 0);
+}
+
 export interface SupervisorStatisticsTableProps {
   supervisorId: string;
   downloadFilename?: string;
@@ -111,6 +118,7 @@ export const SupervisorStatisticsTable = 
React.memo(function SupervisorStatistic
         className: 'padded',
         width: 200,
         accessor: 'rowStats.totals.buildSegments',
+        sortMethod: sortByProcessedBytes,
         Cell: c => renderCounters(c, false),
       },
     ];
@@ -130,6 +138,7 @@ export const SupervisorStatisticsTable = 
React.memo(function SupervisorStatistic
               className: 'padded',
               width: 200,
               accessor: `rowStats.movingAverages.buildSegments.${interval}`,
+              sortMethod: sortByProcessedBytes,
               Cell: c => renderCounters(c, true),
             };
           }),
diff --git 
a/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
 
b/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
index 888e718a258..9ceb251bf97 100644
--- 
a/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
+++ 
b/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
@@ -19,6 +19,7 @@
 import { Button, Icon, Intent } from '@blueprintjs/core';
 import { IconNames } from '@blueprintjs/icons';
 import classNames from 'classnames';
+import { sum } from 'd3-array';
 import React from 'react';
 import type { Column } from 'react-table';
 import ReactTable from 'react-table';
@@ -510,6 +511,8 @@ export const ExecutionStagesPane = React.memo(function 
ExecutionStagesPane(
             accessor: 'counts',
             className: 'padded wrapped',
             width: 300,
+            sortMethod: (a: Record<string, number>, b: Record<string, number>) 
=>
+              sum(Object.values(a), Number) - sum(Object.values(b), Number),
             Cell({ value }) {
               const entries = Object.entries(value);
               if (!entries.length) return '-';


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to