You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Dmitry Sysolyatin (Jira)" <ji...@apache.org> on 2023/01/09 10:46:00 UTC
[jira] [Created] (CALCITE-5468) SqlToRelConverter should register sub-queries inside ORDER BY clause for queries without aggregation
Dmitry Sysolyatin created CALCITE-5468:
------------------------------------------
Summary: 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
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)