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

[jira] [Updated] (CALCITE-5468) SqlToRelConverter throws if ORDER BY contains IN

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

Dmitry Sysolyatin updated CALCITE-5468:
---------------------------------------
    Affects Version/s: 1.33.0

> SqlToRelConverter throws if ORDER BY contains IN
> ------------------------------------------------
>
>                 Key: CALCITE-5468
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5468
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.32.0, 1.33.0
>            Reporter: Dmitry Sysolyatin
>            Assignee: Dmitry Sysolyatin
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.34.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> 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)