Udi Meiri created BEAM-8502:
-------------------------------
Summary: Python typehints: support type hint decorators with
ptransform_fn
Key: BEAM-8502
URL: https://issues.apache.org/jira/browse/BEAM-8502
Project: Beam
Issue Type: Bug
Components: sdk-py-core
Reporter: Udi Meiri
Assignee: Udi Meiri
In this example, the input type hint does not currently get propagated:
{code}
def test_typed_ptransform_fn(self):
# Test that type hints are propagated to the created PTransform.
@beam.ptransform_fn
@typehints.with_input_types(int)
def MyMap(pcoll):
return pcoll | beam.ParDo(lambda x: [x])
self.assertListEqual([1, 2, 3], [1, 2, 3] | MyMap())
with self.assertRaises(typehints.TypeCheckError):
_ = ['a'] | MyMap()
{code}
The fix is relatively simple but might break existing pipelines that have old
(unchecked) hints.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)