datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

to_timestamp align with postgresql

Open waitingkuo opened this issue 3 years ago • 2 comments

Which issue does this PR close?

Closes #2979 .

Rationale for this change

original to_timestamp assume time unit is nanosecond. this pr is to change it to second based (to align with postgresql's to_timestamp)

What changes are included in this PR?

to_timestamp use seconds instead of nanoseconds. a new to_timestamp_nanos expression is added that has the same behavior as the original to_timestamp

Are there any user-facing changes?

Yes. To migrate to new to_timestamp. The original usage for to_timestamp(1_000_000_000) need to be modified to either to_timestamp(1) or to_timestamp_nanos(1_000_000_000)

this pr has the breaking changes to puublic API: to_timestamp

waitingkuo avatar Aug 01 '22 14:08 waitingkuo

pending due to #2998 . this make SELECT to_timestamp(a) FROM (SELECT to_timestamp(1) as a)A return wrong result

waitingkuo avatar Aug 01 '22 14:08 waitingkuo

#2998 merged, test cases passed

waitingkuo avatar Aug 01 '22 21:08 waitingkuo

Closing as this PR is over a year old. Please feel free to reopen it / rebase it if you plan to keep working on it

alamb avatar Nov 28 '23 20:11 alamb