You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: Support TypedDict hint in Apache Beam. #24704
CoGroupByKey produces Dict[K, Union[...]], which is narrower than TypedDict. If the user follows the CoGroupByKey with a ParDo where the function takes TypeDict as input, e.g. ParDo(fn(element: TypedDict)), then the type check in Beam fails.
changed the title [-][Feature Request]: Support TypeDict hint in Apache Beam.[/-][+][Feature Request]: Support TypedDict hint in Apache Beam.[/+]on Jul 24, 2023
Activity
AnandInguva commentedon Dec 19, 2022
Update the issue title?
[-][Feature Request]: [/-][+][Feature Request]: Support TypeDict hint in Apache Beam.[/+]tvalentyn commentedon Dec 20, 2022
Done, thanks.
bfontaine commentedon Mar 24, 2023
Why have specific code for
TypedDictwhen you can use the more genericMapping, which accepts not onlyTypedDict, but also any kind of dict?Note: there’s a typo in the issue title: it should be "TypedDict", not "TypeDict".aaronsarna commentedon Jul 24, 2023
The value of TypedDict over Mapping is if the different keys are expected to have different values. For example, let's say I did the following:
If using Mapping, the method would have to start:
since the type checker can't tell which key corresponds with which value type.
If I could instead have a TypedDict, it could be a bit cleaner:
and the type checker needs no additional help.
[-][Feature Request]: Support TypeDict hint in Apache Beam.[/-][+][Feature Request]: Support TypedDict hint in Apache Beam.[/+]tvalentyn commentedon Jul 24, 2023
cc: @jrmccluskey