Adam Szmigin created ARROW-8581:
-----------------------------------
Summary: [C#] Date32/64Array write & read back introduces
off-by-one error
Key: ARROW-8581
URL: https://issues.apache.org/jira/browse/ARROW-8581
Project: Apache Arrow
Issue Type: Bug
Components: C#
Affects Versions: 0.17.0
Environment: Windows 10 x64
Reporter: Adam Szmigin
h1. Summary
Writing a Date value using either a {{Date32Array.Builder}} or
{{Date64.Builder}} and then reading back the result from the built array
introduces an off-by-one error in the value. The following minimal code
illustrates:
{code:c#}
namespace Date32ArrayReadWriteBug
{
using Apache.Arrow;
using Apache.Arrow.Memory;
using System; internal static class Program
{
public static void Main(string[] args)
{
var allocator = new NativeMemoryAllocator();
var builder = new Date32Array.Builder();
var date = new DateTime(2020, 4, 24);
Console.WriteLine($"Appending date {date:yyyy-MM-dd}");
builder.Append(date);
var array = builder.Build(allocator);
var dateAgain = array.GetDate(0);
Console.WriteLine($"Read date {dateAgain:yyyy-MM-dd}");
}
}
}{code}
h2. Expected Output
{noformat}
Appending date 2020-04-24
Read date 2020-04-24 {noformat}
h2. Actual Output
{noformat}
Appending date 2020-04-24
Read date 2020-04-23 {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)