[ 
https://issues.apache.org/jira/browse/BEAM-8502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Udi Meiri updated BEAM-8502:
----------------------------
    Status: Open  (was: Triage Needed)

> 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
>            Priority: Major
>
> In this example, the input type hint does not currently get propagated 
> (TypeCheckError is not raise):
> {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)

Reply via email to