Mihai Budiu created CALCITE-7146:
------------------------------------
Summary: TIMESTAMPDIFF accepts arguments with mismatched types
Key: CALCITE-7146
URL: https://issues.apache.org/jira/browse/CALCITE-7146
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.40.0
Reporter: Mihai Budiu
Calcite will typecheck this:
{code:sql}
SELECT TIMESTAMPDIFF(DAY, DATE '2020-01-01', TIME '10:00:00')
{code}
and reduce it to 36000000 - 18262, subtracting days from milliseconds.
One solution would be to reject arithmetic between DATE and TIME. Another
solution would be to treat this by casting both to TIMESTAMP. Of course, the
semantics of casting a TIME to TIMESTAMP is also not clearly defined -
currently Calcite seems to use Unix EPOCH for the DATE in such casts.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)