tvalentyn commented on code in PR #25795:
URL: https://github.com/apache/beam/pull/25795#discussion_r1140600127
##########
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:
Thanks. is there a FR for that in
https://github.com/apache/beam/issues?q=is%3Aopen+label%3Apython+label%3Atypes+sort%3Aupdated-desc+
?
--
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]