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 2023/12/30 21:46:00 UTC
[jira] [Commented] (CALCITE-6178) WITH RECURSIVE query when cloned using sqlshuttle looses RECURSIVE property
[ https://issues.apache.org/jira/browse/CALCITE-6178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17801397#comment-17801397 ]
Julian Hyde commented on CALCITE-6178:
--------------------------------------
Might be useful for SqlUnparserTest to unparse everything before and after cloning. Could you enable that in this PR? Then maybe you wouldn’t need a specific test case.
Please fix the casing of SqlShuttle in the subject.
> WITH RECURSIVE query when cloned using sqlshuttle looses 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)