jrmccluskey commented on code in PR #33427: URL: https://github.com/apache/beam/pull/33427#discussion_r1905687490
########## sdks/python/apache_beam/typehints/native_type_compatibility.py: ########## @@ -216,6 +275,24 @@ def convert_collections_to_typing(typ): return typ +def is_builtin(typ): + if typ in _BUILTINS: + return True + return getattr(typ, '__origin__', None) in _BUILTINS + + +# During type inference of WindowedValue, we need to pass in the inner value +# type. This cannot be achieved immediately with WindowedValue class because it +# is not parameterized. Changing it to a generic class (e.g. WindowedValue[T]) +# could work in theory. However, the class is cythonized and it seems that +# cython does not handle generic classes well. +# The workaround here is to create a separate class solely for the type +# inference purpose. This class should never be used for creating instances. +class TypedWindowedValue(Generic[T]): Review Comment: Oh I see what happened, this got mixed in when I dealt with merge conflicts. This was from Shunping's work on the reshuffle coder issue, but that PR was reverted at some point. I'll remove this. -- 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]
