Incorrect coder inference for List and Tuple typehints.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
We seem to use a FastPrimitivesCoder for List and Tuple typehints with homogenous element types, and fail to do the type checking:
```
inputs = (1, "a string")
coder = typecoders.registry.get_coder(typehints.Tuple[int, str])
print(type(coder))
#
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)) #
- 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)) #
- wrong coder?
encoded = coder.encode(inputs)
# No errors - incorrect behavior.
```
Imported from Jira [BEAM-4441](https://issues.apache.org/jira/browse/BEAM-4441). Original Jira may contain additional context.
Reported by: tvalentyn.
Contributor guide
Assessment
This issue has not been assessed yet.