Abacn commented on code in PR #22561:
URL: https://github.com/apache/beam/pull/22561#discussion_r952984871
##########
sdks/python/apache_beam/coders/row_coder.py:
##########
@@ -163,10 +165,15 @@ def _nonnull_coder_from_type(field_type):
_coder_from_type(field_type.map_type.key_type),
_coder_from_type(field_type.map_type.value_type))
elif type_info == "logical_type":
- # Special case for the Any logical type. Just use the default coder for an
- # unknown Python object.
if field_type.logical_type.urn == PYTHON_ANY_URN:
+ # Special case for the Any logical type. Just use the default coder for
an
+ # unknown Python object.
return typecoders.registry.get_coder(object)
+ elif field_type.logical_type.urn == DATETIME_URN:
+ # Special case for datetime logical type.
+ # DATETIME_URN explicitly uses TimestampCoder which deals with fix length
+ # 8-bytes big-endian-long instead of varint coder.
+ return TimestampCoder()
Review Comment:
ah... test case in standard_coders.yaml won't work either because Both
micros_instant and millis_instant has Timestamp language type and the former
will take over the priority of millis_instant (by design). When a timestamp is
decoded to an integer, the test will call micros_instant's to_language_type.
i.e. MillisInstant->Timestamp conversion is one direction and Timestamp
<-> MicrosInstant is bidirectional.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]