You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jess Balint (Jira)" <ji...@apache.org> on 2022/06/23 23:18:00 UTC
[jira] [Resolved] (CALCITE-5013) JDBC adapter should retain parentheses if a query in a UNION has a LIMIT clause
[ https://issues.apache.org/jira/browse/CALCITE-5013?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jess Balint resolved CALCITE-5013.
----------------------------------
Fix Version/s: 1.31.0
Resolution: Fixed
Fixed in 1.31.0
* https://github.com/apache/calcite/commit/b2fb2334260fc8c8bd6ab147da24b10f6c772ea8
Thanks [~jiajunbernoulli]!
> JDBC adapter should retain parentheses if a query in a UNION has a LIMIT clause
> -------------------------------------------------------------------------------
>
> Key: CALCITE-5013
> URL: https://issues.apache.org/jira/browse/CALCITE-5013
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Jiajun Xie
> Priority: Major
> Fix For: 1.31.0
>
>
> The JDBC adapter, when generating SQL, should retain parentheses if one of the inputs to a set operator (e.g. UNION) has an LIMIT clause.
> In standard SQL, the operand of UNION should not have LIMIT or ORDER BY. So parse will fail in {{SqlParserTetest#testLimitUnion}} and {{SqlParserTetest#OrderUnion}}.
> When users use parentheses, most engines allow it. See the discussion: CALCITE-1892.
> For simple example, parentheses control the scope of the limit
> {code:java}
> select "product_id" from "product"
> union all
> (select "product_id" from "product" limit 10){code}
> {{unparseBinarySyntax}} will miss parentheses, this change will affect semantics
> {code:java}
> SELECT \"product_id\" FROM \"foodmart\".\"product\"
> UNION ALL
> SELECT \"product_id\" FROM \"foodmart\".\"product\"
> FETCH NEXT 10 ROWS ONLY -- Affect semantics{code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)