TheNeuralBit commented on code in PR #22561:
URL: https://github.com/apache/beam/pull/22561#discussion_r955205112


##########
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:
   Ahhh ok, so it looks like the issue was using Python to generate the test 
values. Another strategy might be to create the schema proto directly. But this 
way works too and is probably less code, thanks!



-- 
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]

Reply via email to