You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Aleksandr Efimov (Jira)" <ji...@apache.org> on 2026/08/26 03:25:00 UTC

[jira] [Resolved] (IMPALA-15302) Calcite planner: export a datetime plus with a literal interval

     [ https://issues.apache.org/jira/browse/IMPALA-15302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksandr Efimov resolved IMPALA-15302.
---------------------------------------
    Resolution: Duplicate

Folded into IMPALA-15296 before review. The work was first cut one sub-task per finding, which came to nine on top of the two the series started with; regrouped by subject so that a reviewer reads the mechanism once and the applications after it. Nothing described here is dropped: the code and the reasoning both live on in IMPALA-15296, and the Gerrit change was abandoned with the same note.

> Calcite planner: export a datetime plus with a literal interval
> ---------------------------------------------------------------
>
>                 Key: IMPALA-15302
>                 URL: https://issues.apache.org/jira/browse/IMPALA-15302
>             Project: IMPALA
>          Issue Type: Sub-task
>          Components: Frontend
>            Reporter: Aleksandr Efimov
>            Assignee: Aleksandr Efimov
>            Priority: Major
>
> Calcite spells a date plus a literal interval as a multiply of the unit by the count, so d + interval 5 days arrives at the seam as +(d, CHECKED_TIMES(5, INTERVAL '1' DAY)). Substrait has add:date_iday and add:date_iyear, but no multiply that takes an interval, so the multiply is what stops the export rather than the plus. A signature for the plus alone does not help, because the multiply fails first.
> Fold a constant interval multiply into the interval literal it works out to, and map Impala's datetime plus onto add. The qualifier comes from the interval operand, which keeps months on the year-month side and days on the day-time one without this code deciding anything.
> A count that is not a literal, as in d + n * interval 1 day, stays refused. Folding adjusts a constant; it cannot remove the multiply, and Substrait has no multiply taking an interval to fall back on.
> Over the TPC-DS queries that carry Calcite goldens this closes the last one that was blocked by something on our side, taking the exporter from 101 of 110 to 102. The eight that remain are a deliberate refusal for SINGLE_VALUE and substrait-java#993 for GROUPING.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)