I’ve noticed that Calcite evaluates to different time unit types than the given 
time unit type in a timestamp difference (I haven’t tested datetimes).
For example:
`(TIMESTAMP'1971-01-01 00:00:00' - TIMESTAMP'1970-01-01 00:00:00') $TIMEUNIT` 
gives 31536000000 (milliseconds) when $TIMEUNIT = SECOND, MINUTE, HOUR, or DAY, 
but 12 (months) when $TIMEUNIT = MONTH, YEAR

This is inconsistent in two dimensions:

  1.  It is not consistent with the time unit specified
  2.  It is not consistent across all time units. (this is the most confusing 
to me)

Is this a bug?
If not, how are end-users supposed to deal with it?
Are they just supposed to know that this evaluates to milliseconds for some 
time units but months for others?

Thanks!
-Ian J. Bertolacci

Reply via email to