You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Ahmet Altay (Jira)" <ji...@apache.org> on 2019/11/07 17:00:01 UTC

[jira] [Commented] (BEAM-8502) Python typehints: support type hint decorators with ptransform_fn

    [ https://issues.apache.org/jira/browse/BEAM-8502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969414#comment-16969414 ] 

Ahmet Altay commented on BEAM-8502:
-----------------------------------

Might be a duplicate of https://issues.apache.org/jira/browse/BEAM-4091

> 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
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)