Anthony Abate created ARROW-7508:
------------------------------------
Summary: DateTime Reading is Broken
Key: ARROW-7508
URL: https://issues.apache.org/jira/browse/ARROW-7508
Project: Apache Arrow
Issue Type: Bug
Components: C#
Affects Versions: 0.15.1
Reporter: Anthony Abate
Assignee: Anthony Abate
DateTime support for writing works - but reading is broken.
This another arithmetic overflow bug (reported a few already) which is causing
date to be misinterpreted
I extracted the current logic out to linqpad and to show the bug and fix:
{code:java}
var dto = DateTimeOffset.Parse("2024-09-25");
(dto.ToUnixTimeMilliseconds() / 86400000).Dump();
// YIELDS: 19991
unchecked (current code)
{
DateTimeOffset.FromUnixTimeMilliseconds(19991 *
86400000).Dump();
// 1/8/1970 WRONG
}
checked
{
DateTimeOffset.FromUnixTimeMilliseconds((long)19991 *
86400000).Dump();
// 9/25/2024 CORRECT
} {code}
this fix is trivial - a cast to long is missing whereever
FromUnixTimeMilliseconds is used
--
This message was sent by Atlassian Jira
(v8.3.4#803005)