Thomas Rebele created CALCITE-5470:
--------------------------------------

             Summary: VolcanoPlanner removes a necessary sort
                 Key: CALCITE-5470
                 URL: https://issues.apache.org/jira/browse/CALCITE-5470
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.32.0
            Reporter: Thomas Rebele


A logical plan that roughly corresponds to SELECT a*a FROM 
(VALUES(-10),(2),(3)) T(a) ORDER BY a*a produces a physical plan that is not 
sorted:
{noformat}
logical plan:
LogicalSort(sort0=[$0], dir0=[ASC])
  LogicalProject($f0=[*($0, $0)])
    LogicalValues(tuples=[[{ -10 }, { 2 }, { 3 }]])
{noformat}
The result should be 4, 9, 100.
{noformat}
physical plan:
EnumerableProject($f0=[*($0, $0)])
  EnumerableValues(tuples=[[{ -10 }, { 2 }, { 3 }]]){noformat}
If I understand the physical plan correctly, its result would be 100, 4, 9.

Using sqlline gives the correct result (see attached log), so the problem could 
be in the test itself.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to