Bug description
Iām experiencing a bug in 6.0.0 RC2 for a table chart using doris as database. When using custom sql in sort query by, and there is a comma in the sql, the chart will report an error, but this is fine in 5.0.0
Screenshots/recordings
Superset version
master / latest-dev
Python version
3.11
Node version
I don't know
Browser
Chrome
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
Hi @xianggao-1020! I'm Dosu and Iām helping the superset team.
This is a regression in Superset 6.0.0 RC2: the backend now enforces a structured format for sorting, so the "sort query by" field expects a list of tuples like [('ds', False), ('name', False)]
(where False
means descending), not a raw SQL string like ds desc, name desc
as in 5.0.0. The frontend only allows selection from known columns/metrics, with no support for freeform SQL in the sort field. This change affects all databases, not just Doris, and comes from recent refactors and stricter schema validation in the chart query API (source).
To resolve this, use the UI controls to select your sort columns and order, rather than entering custom SQL. If you need more complex sorting, you may need to create a calculated column or metric first, then sort by that. There are no documented workarounds for restoring the old behavior.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report š | Other
Comment From: xianggao-1020
@dosuWill the custom sql function be removed later? Or will it be refactored? Is there any documentation for this part?
Comment From: dosubot[bot]
There are no plans or documentation indicating that the custom SQL sorting function will be removed or refactored. Superset now enforces a structured sorting format in the backend, so freeform SQL in the sort field is not supported. Recent changes have actually improved frontend support for sorting by custom SQL columns (see PR #30393), but the backend expects sorting to be defined as a list of (column, direction) pairs, not raw SQL strings (schema reference). There is no official documentation or roadmap about future changes to this feature. The current behavior is considered settled.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report š | Other
Comment From: xianggao-1020
@dosuOnly one sorting field is allowed on the page. What should I do if I want to use multiple fields for sorting?
Comment From: dosubot[bot]
Superset's backend supports multi-field sorting for table charts, but the current frontend only sends one sorting field to the backend when server-side pagination is enabled. Even though the UI shows a tooltip like "Shift + Click to sort by multiple columns," only the first selected sort field is actually used in the query, so true multi-field sorting isn't possible out of the box right now. This limitation is in the frontend state management and query construction, not the backend API (code reference).
If you need multi-field sorting, you have a few options: pre-sort your data in the dataset or database, create a calculated column that encodes your desired order, or modify the frontend code (especially in the TableChart and DataTable components) to propagate all selected sort fields to the backend, which already supports them (frontend code reference). There are no built-in workarounds or configuration switches for this in the current UI.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report š | Other
Comment From: rusackas
CC @betodealmeida