You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2026/09/11 16:32:00 UTC
[jira] [Resolved] (CALCITE-7681) SqlDatetimeSubtractionOperator drops parentheses around compound interval expressions
[ https://issues.apache.org/jira/browse/CALCITE-7681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mihai Budiu resolved CALCITE-7681.
----------------------------------
Fix Version/s: 1.43.0
Resolution: Fixed
Fixed in [https://github.com/apache/calcite/commit/bca2eef42ab0208b87fcfe8e9164402c9f5e1770]
Thank you for the fix [~matthewbayer]
> SqlDatetimeSubtractionOperator drops parentheses around compound interval expressions
> -------------------------------------------------------------------------------------
>
> Key: CALCITE-7681
> URL: https://issues.apache.org/jira/browse/CALCITE-7681
> Project: Calcite
> Issue Type: Bug
> Reporter: Matthew Bayer
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.43.0
>
>
> [{{SqlDialect.unparseSqlDatetimeArithmetic}}|https://github.com/apache/calcite/blob/701da98408d95ecdc8e80af9be2dc805e6c23242/core/src/main/java/org/apache/calcite/sql/SqlDialect.java#L496-L508] does not apply the datetime operator’s precedence when unparsing its right operand.
>
> – Input
> CURRENT_DATE - (INTERVAL '3' YEAR + INTERVAL '3' YEAR)
>
> – Incorrect RelToSql output
> CURRENT_DATE - INTERVAL '3' YEAR + INTERVAL '3' YEAR
--
This message was sent by Atlassian Jira
(v8.20.10#820010)