You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/09 13:55:15 UTC

[GitHub] [beam] yeandy commented on a diff in pull request #16351: Fix default type inference of CombinePerKey.

yeandy commented on code in PR #16351:
URL: https://github.com/apache/beam/pull/16351#discussion_r892832136


##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -1881,14 +1892,15 @@ def FlatMapTuple(fn, *args, **kwargs):  # pylint: disable=invalid-name
 
   # Proxy the type-hint information from the original function to this new
   # wrapped function.
-  type_hints = get_type_hints(fn)
+  type_hints = get_type_hints(fn).with_defaults(
+      typehints.decorators.IOTypeHints.from_callable(fn))
   if type_hints.input_types is not None:
-    wrapper = with_input_types(
-        *type_hints.input_types[0], **type_hints.input_types[1])(
-            wrapper)
+    # FIXME(BEAM-14052): ignore input hints, as we do not have enough

Review Comment:
   ```suggestion
       # TODO(BEAM-14052): ignore input hints, as we do not have enough
   ```



##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -3367,3 +3381,24 @@ def to_runner_api_parameter(self, unused_context):
   def from_runner_api_parameter(
       unused_ptransform, unused_parameter, unused_context):
     return Impulse()
+
+
+def _strip_output_annotations(type_hint):
+  # TODO(robertwb): These should be parameterized types that the

Review Comment:
   Do we want to add a Github issue to track this?



##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -687,7 +688,7 @@ def default_type_hints(self):
   def infer_output_type(self, input_type):
     # TODO(BEAM-8247): Side inputs types.
     return trivial_inference.element_type(
-        self._strip_output_annotations(

Review Comment:
   Can we remove the `_strip_output_annotations` class function (line 741)?



-- 
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-unsubscribe@beam.apache.org

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