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

Dmitry Sysolyatin updated CALCITE-5468:
---------------------------------------
    Labels: pull-request-available  (was: )

> SqlToRelConverter should register sub-queries inside ORDER BY clause for 
> queries without aggregation
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5468
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5468
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.32.0
>            Reporter: Dmitry Sysolyatin
>            Assignee: Dmitry Sysolyatin
>            Priority: Major
>              Labels: pull-request-available
>
> At the moment the following query throws exception:
> {code}
> @Test void testOrderByWithSubQuery() {
>     String sql = "SELECT empno\n"
>         + "FROM emp\n"
>         + "ORDER BY\n"
>         + "CASE WHEN empno IN (1,2) THEN 0 ELSE 1 END";
>     sql(sql).ok();
>   }
> {code}
> {code}
> while converting CASE WHEN `EMP`.`EMPNO` IN (1, 2) THEN 0 ELSE 1 END
> java.lang.RuntimeException: while converting CASE WHEN `EMP`.`EMPNO` IN (1, 
> 2) THEN 0 ELSE 1 END
>       at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable.lambda$registerNodeTypeMethod$1(ReflectiveConvertletTable.java:98)
> {code}
> It happens because SqlToRelConverter does not register sub-query inside ORDER 
> BY if query does not have aggregation



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

Reply via email to