You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mou Wu (Jira)" <ji...@apache.org> on 2022/09/28 15:17:00 UTC
[jira] [Commented] (CALCITE-5299) JDBC adapter sometimes adds unnecessary parentheses around SELECT in WITH body
[ https://issues.apache.org/jira/browse/CALCITE-5299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17610612#comment-17610612 ]
Mou Wu commented on CALCITE-5299:
---------------------------------
[~libenchao] According to Julian's comment: "It's possible that there are tests in SqlParserTest and elsewhere that generate more parentheses than are necessary." in [CALCITE-5265|https://issues.apache.org/jira/browse/CALCITE-5265]. The parentheses around SELECT in WITH body might be acceptable.
And for tests in RelToSqlConverterTest, "WITH ... AS ... SELECT ..." is not a type of RelNode, it's just a type of AST, so we don't need to cover this case in RelToSqlConverterTest.
So i think it's not a bug actually, what do you think?
> JDBC adapter sometimes adds unnecessary parentheses around SELECT in WITH body
> ------------------------------------------------------------------------------
>
> Key: CALCITE-5299
> URL: https://issues.apache.org/jira/browse/CALCITE-5299
> Project: Calcite
> Issue Type: Bug
> Reporter: Mou Wu
> Assignee: Mou Wu
> Priority: Minor
>
> Note: This issue is related to https://issues.apache.org/jira/browse/CALCITE-5265
> You should view comments in CALCITE-5265 before you view this issue.
> Add a case in SqlParserTest:
>
> {code:java}
> // code placeholder
> @Test void testWithSelect() {
> final String sql = "with emp2 as (select * from emp)\n"
> + "select * from emp2\n";
> final String expected = "WITH `EMP2` AS (SELECT *\n" +
> "FROM `EMP`) SELECT *\n" +
> "FROM `EMP2`";
> sql(sql).ok(expected);
> } {code}
> will fail, because actual sql is with parentheses.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)