Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
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).
$ 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
As the specification says, 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.
Attachments
Issue Links
- links to