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/01/09 12:59:00 UTC

[jira] [Commented] (CALCITE-5468) SqlToRelConverter should register sub-queries inside ORDER BY clause for queries without aggregation

    [ https://issues.apache.org/jira/browse/CALCITE-5468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17656094#comment-17656094 ] 

Dmitry Sysolyatin commented on CALCITE-5468:
--------------------------------------------

PR is available https://github.com/apache/calcite/pull/3022

> 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
>
> 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)