You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When playing with the date_part function, I see that there's ways of triggering int32 multiplication overflows that either panic on a debug build, or return the wrong number at runtime.
To Reproduce
Executing the following statement shows the behavior.
Describe the bug
When playing with the date_part function, I see that there's ways of triggering int32 multiplication overflows that either panic on a debug build, or return the wrong number at runtime.
To Reproduce
Executing the following statement shows the behavior.
DataFusion fiddle link <- returns a wrong random number
Postgres fiddle link <- returns 0
Expected behavior
The date_part function should behave the same as Postgres
Additional context
Not 100% sure, but I would say that the changes introduced in #13466 look suspicious. There, the inner calculations are using int32 types, which are easy to overflow. Special mention to this line of code:
https://github.com/gabotechs/datafusion/blob/763bd681f09d58ce285ab3a677b81291c41adfce/datafusion/functions/src/datetime/date_part.rs#L290-L290
The text was updated successfully, but these errors were encountered: