[
https://issues.apache.org/jira/browse/CALCITE-5470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Rebele updated CALCITE-5470:
-----------------------------------
Description:
A test case with the VolcanoPlanner produces an unexpected result
([^test.patch], applied on 4bebdb07c2f45a95c9a4fdf81e9bcfbdd11a15de). 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 [^sqlline.log]), so the problem
could be in the test itself.
was:
A test case with the VolcanoPlanner produces an unexpected result
([^test.patch]). 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 [^sqlline.log]), so the problem
could be in the test itself.
> 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
> Priority: Major
> Attachments: sqlline.log, test.patch
>
>
> A test case with the VolcanoPlanner produces an unexpected result
> ([^test.patch], applied on 4bebdb07c2f45a95c9a4fdf81e9bcfbdd11a15de). 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 [^sqlline.log]), so the problem
> could be in the test itself.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)