Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
1.31.0
-
None
-
None
Description
The following test:
@Test void testUnionAllInSubquery() { final String sql = "select * from \n" + "((select columns[0] as col0 from emps t1) \n" + "union all \n" + "(select columns[0] c2 from emps t2))"; final String expected = "SELECT *\n" + "FROM (SELECT `COLUMNS`[0] AS `COL0`\n" + "FROM `EMPS` AS `T1`\n" + "UNION ALL\n" + "SELECT `COLUMNS`[0] AS `C2`\n" + "FROM `EMPS` AS `T2`)"; sql(sql).ok(expected); }
Fails with the following exception:
Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered "union" at line 3, column 1. Was expecting one of: "AS" ... "CROSS" ... "FULL" ... "INNER" ... "JOIN" ... "LEFT" ... "MATCH_RECOGNIZE" ... "NATURAL" ... "OUTER" ... "RIGHT" ... "TABLESAMPLE" ... ")" ... <BRACKET_QUOTED_IDENTIFIER> ... <QUOTED_IDENTIFIER> ... <BACK_QUOTED_IDENTIFIER> ... <BIG_QUERY_BACK_QUOTED_IDENTIFIER> ... <HYPHENATED_IDENTIFIER> ... <IDENTIFIER> ... <UNICODE_QUOTED_IDENTIFIER> ... at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:398) at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:154) at org.apache.calcite.sql.parser.SqlParser.handleException(SqlParser.java:145) at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:160) at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:185) at org.apache.calcite.sql.parser.SqlParserTest$TesterImpl.parseStmtAndHandleEx(SqlParserTest.java:9863) ... 72 more
This is a regression caused by changes from CALCITE-35
Attachments
Issue Links
- is caused by
-
CALCITE-35 Support parenthesized sub-clause in JOIN
- Closed
- is related to
-
CALCITE-5206 Parser allows MERGE with mismatched parentheses
- Closed