Vladislav Pyatkov created CALCITE-7919:
------------------------------------------

             Summary: Multi-column ORDER BY fails for ARRAY
                 Key: CALCITE-7919
                 URL: https://issues.apache.org/jira/browse/CALCITE-7919
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Vladislav Pyatkov


The following query fails because the generated comparator casts an ARRAY value 
to {{Comparable}}:
{code:sql}
SELECT id
FROM (
  VALUES
    (1, ARRAY[2, 0]),
    (2, ARRAY[1, 2]),
    (3, ARRAY[1, 1])
) AS t(id, k)
ORDER BY k, id;
{code}
Expected result: {{3, 2, 1}}.
Actual error:
{noformat}
java.lang.ClassCastException:
class java.util.ArrayList cannot be cast to class java.lang.Comparable
{noformat}
Sorting by {{k}} alone works correctly, but sorting by multiple columns 
({{ORDER BY k, id}}) fails with an exception.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to