[
https://issues.apache.org/jira/browse/CALCITE-5468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitry Sysolyatin updated CALCITE-5468:
---------------------------------------
Summary: SqlToRelConverter throws if ORDER BY contains IN (was:
SqlToRelConverter should register sub-queries inside ORDER BY clause for
queries without aggregation)
> 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
> Reporter: Dmitry Sysolyatin
> Assignee: Dmitry Sysolyatin
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> 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)