Kengo Seki created AVRO-2792:
--------------------------------
Summary: Fix C# logical type tests to work in other timezones than
UTC
Key: AVRO-2792
URL: https://issues.apache.org/jira/browse/AVRO-2792
Project: Apache Avro
Issue Type: Bug
Reporter: Kengo Seki
Assignee: Kengo Seki
I ran the C# unit tests outside of a container and got the following error.
This is because my machine's timezone is JST (UTC+9).
{code}
$ cd lang/csharp
$ ./build.sh test
(snip)
X TestLogical_TimestampMicrosecond() [22ms]
Error Message:
Expected: 1990-01-01 14:15:30
But was: 1990-01-01 05:15:30
Stack Trace:
at Avro.Test.Generic.GenericTests.test[T](String s, T value) in
/home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
38
at Avro.Test.Generic.GenericTests.TestLogical_TimestampMicrosecond() in
/home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
139
X TestLogical_TimestampMillisecond() [< 1ms]
Error Message:
Expected: 1990-01-01 14:15:30
But was: 1990-01-01 05:15:30
Stack Trace:
at Avro.Test.Generic.GenericTests.test[T](String s, T value) in
/home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
38
at Avro.Test.Generic.GenericTests.TestLogical_TimestampMillisecond() in
/home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
133
X TestTimestampMicrosecond("01/01/2019 14:20:00","01/01/2019 14:20:00Z") [<
1ms]
Error Message:
Expected: 2019-01-01 14:20:00
But was: 2019-01-01 05:20:00
Stack Trace:
at Avro.Test.LogicalTypeTests.TestTimestampMicrosecond(String s, String e)
in
/home/sekikn/repos/avro/lang/csharp/src/apache/test/Util/LogicalTypeTests.cs:line
143
X TestTimestampMillisecond("01/01/2019 14:20:00","01/01/2019 14:20:00Z") [<
1ms]
Error Message:
Expected: 2019-01-01 14:20:00
But was: 2019-01-01 05:20:00
Stack Trace:
at Avro.Test.LogicalTypeTests.TestTimestampMillisecond(String s, String e)
in
/home/sekikn/repos/avro/lang/csharp/src/apache/test/Util/LogicalTypeTests.cs:line
119
Test Run Failed.
Total tests: 584
Passed: 580
Failed: 4
Total time: 2.3598 Seconds
{code}
[As the specification
says|https://avro.apache.org/docs/current/spec.html#Timestamp+%28millisecond+precision%29],
Avro's timestamp logical type has a long value that represents the difference
from the unix epoch (1 Jan 1970 00:00:00 UTC) and it doesn't have timezone
information. So when deserializing it, it's returned as a C# DateTime object
with UTC.
Therefore, if the input string lacks timezone information, we should assume it
represents UTC datetime in these test cases.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)