Hanumath Rao Maduri created CALCITE-6178: --------------------------------------------
Summary: 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 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} @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} -- This message was sent by Atlassian Jira (v8.20.10#820010)