Aleksandr Efimov created IMPALA-15302:
-----------------------------------------
Summary: 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
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)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]