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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]