Trying to understand expected conversion to SQL for TIMESTAMPDIFF function. According to this bug: https://issues.apache.org/jira/projects/CALCITE/issues/CALCITE-3312 <https://issues.apache.org/jira/projects/CALCITE/issues/CALCITE-3312> it is converted to something like: CAST(/INT(Reinterpret(-(2017-01-01 00:00:00, 2016-01-01 00:00:00)), 12)):INTEGER NOT NULL which seems incorrect and missing some info for many databases.
For example, PostgreSQL returns interval in days here: select TIMESTAMP '2017-01-01 00:00:00' - TIMESTAMP '2016-01-01 00:00:00'; ?column? ---------- 366 days (1 row) How Reinterpret supposed to be converted for PostgreSQL given that it doesn't contain output type and what's with division by 12? Willing to fix this, could somebody give an insight? Thanks, Pavel
