You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jiajun Xie (Jira)" <ji...@apache.org> on 2023/04/02 07:38:00 UTC

[jira] [Updated] (CALCITE-5597) SELECT DISTINCT query with ORDER BY column will get error result

     [ https://issues.apache.org/jira/browse/CALCITE-5597?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jiajun Xie updated CALCITE-5597:
--------------------------------
    Summary: SELECT DISTINCT query with ORDER BY column will get error result  (was: Column that be order by should not be aggregated)

> SELECT DISTINCT query with ORDER BY column will get error result
> ----------------------------------------------------------------
>
>                 Key: CALCITE-5597
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5597
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jiajun Xie
>            Priority: Major
>
> Here is unit test
> {code:java}
> @Test void testDistinctOrderByRand() {
>   final String sql = "select distinct deptno from emp order by rand()";
>   sql(sql).ok();
> } {code}
> We will get error logical plan
> {code:java}
> LogicalProject(DEPTNO=[$0])
>   LogicalSort(sort0=[$1], dir0=[ASC])
>     LogicalAggregate(group=[{0, 1}]) //rand() in group, result will be error
>       LogicalProject(DEPTNO=[$7], EXPR$1=[RAND()])
>         LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}



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