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

Beam JIRA Bot commented on BEAM-4441:
-------------------------------------

This issue is assigned but has not received an update in 30 days so it has been 
labeled "stale-assigned". If you are still working on the issue, please give an 
update and remove the label. If you are no longer working on the issue, please 
unassign so someone else may work on it. In 7 days the issue will be 
automatically unassigned.

> Incorrect coder inference for List and Tuple typehints.
> -------------------------------------------------------
>
>                 Key: BEAM-4441
>                 URL: https://issues.apache.org/jira/browse/BEAM-4441
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-py-core
>            Reporter: Valentyn Tymofieiev
>            Assignee: Udi Meiri
>            Priority: P3
>              Labels: stale-assigned
>
> We seem to use a FastPrimitivesCoder for List and Tuple typehints with 
> homogenous element types, and fail to do the type checking:
> {code:python}
> inputs = (1, "a string")
> coder = typecoders.registry.get_coder(typehints.Tuple[int, str])
> print(type(coder)) # <class 'apache_beam.coders.coders.TupleCoder'>
> encoded = coder.encode(inputs) 
> # Fails: TypeError: an integer is required - correct behaviour
> coder = typecoders.registry.get_coder(typehints.Tuple[int, ...]) # A tuple of 
> integers.
> print(type(coder)) # <class 'apache_beam.coders.coders.FastPrimitivesCoder'> 
> - wrong coder?
> encoded = coder.encode(inputs)
> # No errors - incorrect behavior.
> coder = typecoders.registry.get_coder(typehints.List[int]) # A list of 
> integers.
> print(type(coder)) # <class 'apache_beam.coders.coders.FastPrimitivesCoder'> 
> - wrong coder?
> encoded = coder.encode(inputs)
> # No errors - incorrect behavior.{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to