HamzaLghali opened a new issue, #44343: URL: https://github.com/apache/superset/issues/44343
### Bug description Hi everyone, I upgraded Superset from **3.0.0** to **5.0.0** and I can no longer sort one of my bar charts by its metric. I'd appreciate help understanding why and how to get the sort option back. ### My situation I have a horizontal Bar Chart, "TOP 10 G Affiliates with the most G Implementation Requests": - **Y-axis:** `g_code` - **Metric:** `Amount` - **Dataset:** a virtual (SQL) dataset on **MySQL**, built with subqueries and a `UNION ALL` **In 3.0.0**, the Data tab had a **"Y-Axis Sort By"** control. I set it to `Amount GFR` and the bars were ordered from highest to lowest. **In 5.0.0**, the "Y-Axis Sort By" control no longer appears for this chart, so the bars show in category-name order. ### What I noticed - In the dataset's column list, `gin_code` (and almost every other column) has the **`?`** icon, as if Superset doesn't know its type. - In **another** bar chart on 5.0.0, sorting still works. Its axis column `test_end_year` shows the **`#`** icon, and after I check "Force categorical", the "X-Axis Sort By" control appears. - For the `?` column, there is no "Force categorical" checkbox and no sort control. So the sort option seems to depend on the detected column type, but I'm not sure. ### What I've tried - Upgrading again to the latest version (same result) - <Sync columns from source: result> - <Casting in SQL, e.g. `CAST(gin_code AS CHAR)`: result> - <Manually setting the data type to VARCHAR in Edit dataset → Columns: result> ### My questions 1. Did the rule for showing "Axis Sort By" change between 3.x and 5.x? Is it now hidden when the column type is unknown? 2. Why would MySQL string columns in a virtual dataset be detected as `?` instead of `ABC`? 3. What is the recommended way to make this column sortable by a metric again? ### Screenshots - 3.0.0 with the sort control visible: <img width="307" height="247" alt="Image" src="https://github.com/user-attachments/assets/569ea212-38ae-4fff-b078-a7242918ffc4" /> - 5.0.0, same chart, sort control missing: <img width="295" height="259" alt="Image" src="https://github.com/user-attachments/assets/f9090ccb-147e-4a35-93b7-6eb3fe6aa9fd" /> - 5.0.0, another chart where sorting works: <img width="325" height="312" alt="Image" src="https://github.com/user-attachments/assets/a2d8e412-3148-48c0-9481-0a0945d47ac4" /> ### Environment - Superset: 5.0.0 (upgraded from 3.0.0) - Database: MySQL - Installation: kubernetes I found this discussion, which looks similar: https://github.com/apache/superset/discussions/29271 It suggests a calculated column with its type set to String as a workaround. I'd like to know whether that is the intended approach or whether there is a better fix. Thanks in advance for your help! ### Screenshots/recordings _No response_ ### Superset version master / latest-dev ### Python version 3.11 ### Node version 16 ### Browser Chrome ### Additional context _No response_ ### Checklist - [ ] I have searched Superset docs and Slack and didn't find a solution to my problem. - [ ] I have searched the GitHub issue tracker and didn't find a similar bug report. - [ ] 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. -- 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]
