Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5.10
-
None
-
Ubuntu 20.04.2 LTS focal
Description
Simple unions break sorting.
Here's a relatively simple query format that demonstrates this on a columnstore table:
SELECT
label,
count
FROM (
SELECT
label,
COUNT(my_table.id) as count
FROM my_table
GROUP BY label
UNION ALL
SELECT "NONE" as label, 0 as count
UNION ALL
SELECT "NONE" as label, -1 as count
) AS A ORDER BY count
This will yield a sort order where -1 is considered the largest value.
This is likely a signed/unsigned integer issue.
Of note:
- Does not break on a Sum, have not tested other grouping operations
- Have not tested other sort engines
- Did not break in our previous version of columnstore some ~4 years ago
Active Workaround:
replace literal for -1 with cast(-1 AS float) acts as workaround