You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Vitor-Avila (via GitHub)" <gi...@apache.org> on 2025/11/26 23:28:42 UTC

Re: [PR] fix: Do no aggregate results when `metrics=[]` [superset]

Vitor-Avila commented on code in PR #36247:
URL: https://github.com/apache/superset/pull/36247#discussion_r2566716455


##########
superset-frontend/plugins/plugin-chart-ag-grid-table/test/buildQuery.test.ts:
##########
@@ -474,5 +474,35 @@ describe('plugin-chart-ag-grid-table', () => {
 
       expect(query.columns).toEqual(['state', 'city']);
     });
+
+    it('should preserve undefined metrics in RAW RECORDS mode with columnOrder', () => {
+      const rawFormData: TableChartFormData = {
+        viz_type: VizType.Table,
+        datasource: '11__table',
+        query_mode: QueryMode.Raw,
+        all_columns: ['order_number', 'product_line', 'country'],
+      };
+
+      const query = buildQuery(
+        {
+          ...rawFormData,
+          result_format: 'csv',
+        },
+        {
+          ownState: {
+            columnOrder: ['country', 'product_line', 'order_number'],
+          },
+        },
+      ).queries[0];
+
+      // Columns should be reordered
+      expect(query.columns).toEqual([
+        'country',
+        'product_line',
+        'order_number',
+      ]);
+      // Metrics must be undefined (not []) to prevent backend from adding GROUP BY

Review Comment:
   Good call! I've updated the logic to fix the issue at the backend level



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org