You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2024/01/08 19:01:00 UTC
[jira] [Updated] (CALCITE-6178) WITH RECURSIVE query when cloned using SqlShuttle loses RECURSIVE property
[ https://issues.apache.org/jira/browse/CALCITE-6178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde updated CALCITE-6178:
---------------------------------
Summary: WITH RECURSIVE query when cloned using SqlShuttle loses RECURSIVE property (was: WITH RECURSIVE query when cloned using SqlShuttle looses RECURSIVE property)
> WITH RECURSIVE query when cloned using SqlShuttle loses RECURSIVE property
> --------------------------------------------------------------------------
>
> Key: CALCITE-6178
> URL: https://issues.apache.org/jira/browse/CALCITE-6178
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.36.0
> Reporter: Hanumath Rao Maduri
> Assignee: Hanumath Rao Maduri
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Here is a test case which shows that a recursive query becomes a non recursive query when cloned using SqlShuttle.
> Copy paste the below test case in SqlParserTest
> {code:java}
> @Test void testRecursiveQueryCloned() throws Exception {
> SqlNode sqlNode = sql("with RECURSIVE emp2 as "
> + "(select * from emp union select * from emp2) select * from emp2").parser().parseStmt();
> SqlNode sqlNode1 = sqlNode.accept(new SqlShuttle() {
> @Override public SqlNode visit(SqlIdentifier identifier) {
> return new SqlIdentifier(identifier.names, identifier.getParserPosition());
> }
> });
> System.out.println(sqlNode1.toSqlString(c -> c.withAlwaysUseParentheses(false)).getSql());
> }{code}
> The above test case generates following output.
> {code:java}
> WITH "EMP2" AS (SELECT *
> FROM "EMP"
> UNION
> SELECT *
> FROM "EMP2") SELECT *
> FROM "EMP2"{code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)