claudevdm commented on code in PR #35243:
URL: https://github.com/apache/beam/pull/35243#discussion_r2162113182


##########
sdks/python/apache_beam/io/external/xlang_jdbcio_it_test.py:
##########
@@ -255,10 +253,6 @@ def test_xlang_jdbc_write_read(self, database):
               classpath=config['classpath'],
           ))
 
-    # Register MillisInstant logical type to override the mapping from 
Timestamp
-    # originally handled by MicrosInstant.
-    LogicalType.register_logical_type(MillisInstant)

Review Comment:
   When we read from jdbc, we get a schema with a millis_instant urn e.g.
   ```
   fields {
     name: "created_at"
     type {
       nullable: true
       logical_type {
         urn: "beam:logical_type:millis_instant:v1"
         representation {
           atomic_type: INT64
         }
       }
     }
     id: 2
     encoding_position: 2
   }
   ```
   
   Then in named_tuple_from_schema we try map the schema fields to python types 
https://github.com/apache/beam/blob/0d6c94a8727627ee295a13b1736ceda4137f8aa3/sdks/python/apache_beam/typehints/schemas.py#L541.
   
   ```
   [('created_at', typing.Optional[apache_beam.typehints.schemas.Timestamp])]
   ```
   
   The coder for this tuple will use MicrosInstant because that was registered 
last for Timestamp.
   
   
   I am testing a fix here to use a stub type so that 
   beam:logical_type:millis_instant:v1 -> Stub Type -> MillisInstant -> 
Timestamp
   https://github.com/apache/beam/pull/35400
   
   



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to