apache / apache/beam

Flatten operation should respect input type hints.

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

Description

Input type hints are currently not respected by the Flatten operation and instead `Any` type is chosen as a fallback. This could lead to using a pickle coder even if there was a custom coder type hint provided for input PCollections.

Also, this could lead to undesirable results, particularly, when a Flatten operation is followed by a GroupByKey operation which requires the key coder to be deterministic. Even if the user provides deterministic coder type hints to their PCollections, defaulting to Any would result in using the pickle coder (non-deterministic). As a result of this, CoGroupByKey is broken in such scenarios where input PCollection coder is deterministic for the type while pickle coder is not.

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

Contributor guide

Open the contributing guide

Research direction

Start at the Python SDK's Flatten operation and trace how input PCollection type hints are handled, then compare the behavior with GroupByKey and CoGroupByKey. Confirm that custom deterministic coder hints are preserved through Flatten and that the downstream grouping operations no longer fall back to the non-deterministic pickle coder.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.