nehsyc commented on pull request #13493:
URL: https://github.com/apache/beam/pull/13493#issuecomment-739589853


   I didn't add `ShardedKeyTypeConstraint` to typehint.py specifically here
   
https://github.com/apache/beam/blob/30f9a607509940f78459e4fba847617399780246/sdks/python/apache_beam/typehints/typehints.py#L1116
   due to cyclic imports. I could have moved the entire definition to 
typehints.py but I also needed to register the coder for the type constraint 
via `typecoders.registry.register_coder` which couldn't be done within 
typehints.py (again due to cyclic imports). Let me know if the current version 
is fine or any suggestions to make it more clear. 
   
   Thinking it more about whether this constraint can be used by users. 
Actually no such need. `ShardedKey` is not a magic type but just a normal type. 
We made it well-known because we want the transform `GroupIntoBatches` that 
uses `ShardedKey` to be a magic transform. So user defined transforms that 
involve `ShardedKey` don't have to have `ShardedKeyCoder` in the graph (generic 
fast primitive coder should work).


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to