You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksey Plekhanov (Jira)" <ji...@apache.org> on 2021/09/01 10:21:00 UTC

[jira] [Created] (IGNITE-15418) Calcite engine. TIMESTAMPDIFF function returns INTEGER type for MICROSECOND time unit

Aleksey Plekhanov created IGNITE-15418:
------------------------------------------

             Summary: Calcite engine. TIMESTAMPDIFF function returns INTEGER type for MICROSECOND time unit
                 Key: IGNITE-15418
                 URL: https://issues.apache.org/jira/browse/IGNITE-15418
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov


SQL function {{TIMESTAMPDIFF}} returns {{INTEGER}} type for {{MICROSECOND}} time unit, but sometimes precession of {{int}} is not enough to store value. For example, value for
{code:java}
SELECT TIMESTAMPDIFF(MICROSECOND, TIMESTAMP '2022-02-01 10:30:26.000', TIMESTAMP '2022-05-01 10:30:28.122'){code}
is {{7689602122000}}, and it's more then maximum {{int}} value. It's better to extend {{TIMESTAMPDIFF}} return type to {{BIGINT}} for {{MICROSECOND}} time unit (\{{SqlTimestampDiffFunction.RETURN_TYPE_INFERENCE}} should be changed). 

The main problem - this function is defined in Calcite and hardcoded in the parser (see {{TimestampDiffFunctionCall}} in {{Parser.jj}}), so it's not so easy to provide our own implementation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)