mirror of
https://github.com/apache/superset.git
synced 2026-05-09 18:05:52 +00:00
fix: revert and restore server-side sorting for value axis sorts (#39331)
This commit is contained in:
committed by
GitHub
parent
c971ea3ec6
commit
da371217ef
@@ -19,7 +19,6 @@
|
||||
import {
|
||||
QueryFormColumn,
|
||||
QueryFormData,
|
||||
QueryObject,
|
||||
QueryFormOrderBy,
|
||||
buildQueryContext,
|
||||
ensureIsArray,
|
||||
@@ -38,13 +37,17 @@ export default function buildQuery(formData: QueryFormData) {
|
||||
...ensureIsArray(groupby),
|
||||
];
|
||||
const orderby: QueryFormOrderBy[] = [];
|
||||
if (sort_x_axis && !sort_x_axis.includes('value')) {
|
||||
// Value sorts are applied post-query; SQL orderby biases row_limit truncation.
|
||||
orderby.push([columns[0], sort_x_axis.includes('asc')]);
|
||||
if (sort_x_axis) {
|
||||
orderby.push([
|
||||
sort_x_axis.includes('value') ? metric : columns[0],
|
||||
sort_x_axis.includes('asc'),
|
||||
]);
|
||||
}
|
||||
if (sort_y_axis && !sort_y_axis.includes('value')) {
|
||||
// Value sorts are applied post-query; SQL orderby biases row_limit truncation.
|
||||
orderby.push([columns[1], sort_y_axis.includes('asc')]);
|
||||
if (sort_y_axis) {
|
||||
orderby.push([
|
||||
sort_y_axis.includes('value') ? metric : columns[1],
|
||||
sort_y_axis.includes('asc'),
|
||||
]);
|
||||
}
|
||||
const group_by =
|
||||
normalize_across === 'x'
|
||||
@@ -52,7 +55,7 @@ export default function buildQuery(formData: QueryFormData) {
|
||||
: normalize_across === 'y'
|
||||
? getColumnLabel(groupby as unknown as QueryFormColumn)
|
||||
: undefined;
|
||||
return buildQueryContext(formData, (baseQueryObject: QueryObject) => [
|
||||
return buildQueryContext(formData, baseQueryObject => [
|
||||
{
|
||||
...baseQueryObject,
|
||||
columns,
|
||||
|
||||
Reference in New Issue
Block a user