[
https://issues.apache.org/jira/browse/CALCITE-6063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ran Tao updated CALCITE-6063:
-----------------------------
Description:
calcite support array query constructor.
but If we run sub-query with orderby:
{code:java}
select array(select x from unnest(array[1,2,3]) as t(x) order by x desc);
select array(select x from unnest(array[1,2,3]) as t(x) order by x asc); {code}
they both return
{code:java}
+-----------+
| EXPR$0 |
+-----------+
| [1, 2, 3] |
+-----------+
{code}
however, we expect return *[3, 2, 1]* when use {*}order by x desc{*}.
It seems that the *order by* not works properly in array sub-query.
This issue is introduced by the issue
https://issues.apache.org/jira/browse/CALCITE-2978
However the ARRAY is not applicable in this scenario.
we also have another issue broke it.
https://issues.apache.org/jira/browse/CALCITE-3738
was:
calcite support array query constructor.
but If we run sub-query with orderby:
{code:java}
select array(select x from unnest(array[1,2,3]) as t(x) order by x desc);
select array(select x from unnest(array[1,2,3]) as t(x) order by x asc); {code}
they both return
{code:java}
+-----------+
| EXPR$0 |
+-----------+
| [1, 2, 3] |
+-----------+
{code}
however, we expect return *[3, 2, 1]* when use {*}order by x desc{*}.
It seems that the *order by* not works properly in array sub-query.
This issue is introduced by the issue
https://issues.apache.org/jira/browse/CALCITE-2978
However the array is not applicable in this scenario.
we also have another issue broke it.
https://issues.apache.org/jira/browse/CALCITE-3738
> ARRAY subquery with OrderBy loses Sort
> --------------------------------------
>
> Key: CALCITE-6063
> URL: https://issues.apache.org/jira/browse/CALCITE-6063
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.35.0
> Reporter: Ran Tao
> Assignee: Ran Tao
> Priority: Major
>
> calcite support array query constructor.
> but If we run sub-query with orderby:
> {code:java}
> select array(select x from unnest(array[1,2,3]) as t(x) order by x desc);
> select array(select x from unnest(array[1,2,3]) as t(x) order by x asc);
> {code}
> they both return
> {code:java}
> +-----------+
> | EXPR$0 |
> +-----------+
> | [1, 2, 3] |
> +-----------+
> {code}
> however, we expect return *[3, 2, 1]* when use {*}order by x desc{*}.
> It seems that the *order by* not works properly in array sub-query.
> This issue is introduced by the issue
> https://issues.apache.org/jira/browse/CALCITE-2978
> However the ARRAY is not applicable in this scenario.
> we also have another issue broke it.
> https://issues.apache.org/jira/browse/CALCITE-3738
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)