apache / apache/beam

PTransform input_types hint with potential empty input

Open
#18,774 0 comments 0 reactions 0 assignees View on GitHub
bug core P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

User reported issue:

... PTransform class that takes a pcollection of Dict[str, numpy.ndarray] as input, and I added the annotation of @beam.typehints.with_input_types(beam.typehints.Dict[str, numpy.ndarray]). However, this causes error to empty dict input, and the error message is """Input type hint violation at _TopKStatsGeneratorImpl: expected Dict[str, ndarray], got Dict[Union[], Union[]] """

From the user report it seems like our type hints could be more flexible in what they accept for empty dictionaries.

Imported from Jira [BEAM-4506](https://issues.apache.org/jira/browse/BEAM-4506). Original Jira may contain additional context.
Reported by: altay.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.