You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Udi Meiri (Jira)" <ji...@apache.org> on 2020/10/05 18:01:00 UTC
[jira] [Commented] (BEAM-10979) Python CoGBK should propagate
typehints
[ https://issues.apache.org/jira/browse/BEAM-10979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17208226#comment-17208226 ]
Udi Meiri commented on BEAM-10979:
----------------------------------
My first idea would be to add annotations to CoGroupByKey.expand. From what I understand it should look like this:
{code}
def expand(self, pcolls: Dict[T, PCollection[Tuple[K, V]]]) -> \
PCollection[Tuple[K, Dict[T, Iterable[V]]]]:
{code}
However Beam fails to convert this to its internal typing system.
{code}
E TypeError: Value-type parameter to a Dict hint must be a non-sequence, a type, or a TypeConstraint. apache_beam.pvalue.PCollection[typing.Tuple[~K, ~V]] is an instance of _GenericAlias.
{code}
I also believe that TypeVar binding needs special support.
Overriding default_type_hints might help here, including the infer_* and type_check_* methods.
> Python CoGBK should propagate typehints
> ---------------------------------------
>
> Key: BEAM-10979
> URL: https://issues.apache.org/jira/browse/BEAM-10979
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Brian Hulette
> Priority: P2
> Labels: types
>
> Currently CoGBK erases type hints, but they could be propagated
--
This message was sent by Atlassian Jira
(v8.3.4#803005)