AVRO-3078: Add local-timestamp-millis and local-timestamp-micros logical types to C##1628
AVRO-3078: Add local-timestamp-millis and local-timestamp-micros logical types to C##1628martin-g merged 4 commits intoapache:masterfrom zcsizmadia:avro-3078-implement-local-timestamp-millis
Conversation
|
Thank you, @zcsizmadia ! |
| public override object ConvertToLogicalValue(object baseValue, LogicalSchema schema) | ||
| { | ||
| return UnixEpochDateTime.AddMilliseconds((long)baseValue).ToLocalTime(); |
There was a problem hiding this comment.
Is it correct to convert from UTC to local time here? From https://avro.apache.org/docs/1.11.0/spec.html#Local+timestamp+(millisecond+precision), I get the impression that 0 should mean 1 January 1970 00:00:00.000 local time, rather than 1 January 1970 00:00:00.000 UTC converted to local time. I'd really expect the result to have DateTimeKind.Unspecified because it's local time but not necessarily local to the computer in which this library is run.
In the Java implementation, LocalTimestampMillisConversion.fromLong first converts 0 to 1 January 1970 00:00:00.000 UTC and then drops the UTC time zone information, leaving 1 January 1970 00:00:00.000 without a time zone.
avro/lang/java/avro/src/main/java/org/apache/avro/data/TimeConversions.java
Lines 221 to 224 in 4282288
Related test:
Make sure you have checked all steps below.
Jira
Tests
Commits
Documentation