tvalentyn commented on code in PR #25795:
URL: https://github.com/apache/beam/pull/25795#discussion_r1139065133


##########
sdks/python/apache_beam/typehints/trivial_inference.py:
##########
@@ -498,6 +518,40 @@ def infer_return_type_func(f, input_types, debug=False, 
depth=0):
       else:
         return_type = typehints.Any
       state.stack[-pop_count:] = [return_type]
+    elif opname == 'CALL':
+      pop_count = 1 + arg
+      # Keyword Args case
+      if state.kw_names is not None:
+        if isinstance(state.stack[-pop_count], Const):
+          from apache_beam.pvalue import Row
+          if state.stack[-pop_count].value == Row:
+            fields = state.kw_names
+            return_type = row_type.RowTypeConstraint.from_fields(
+                list(
+                    zip(fields,
+                        Const.unwrap_all(state.stack[-pop_count + 1:]))))
+          else:
+            return_type = Any

Review Comment:
   Re places where we return 'Any', could you comment on why we currently don't 
attempt any inference there, and whether it would make sense track those  as 
feature requests (we have several issues tagged as 'types', some of these FRs 
may be already filed). 



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