apache / apache/beam

Construct iterators directly if possible to allow spilling to disk

Open
#18,529 0 comments 0 reactions 0 assignees View on GitHub
improvement P3 runners spark
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
205

Description

When you construct a collection first and convert it to an iterator you force Spark to evaluate the entire input partition before it can get the first element off the output. This breaks some of the spilling to disk Spark can do otherwise. Instead chain operations on Iterators.

This is only possible in the Java API for Spark 2 and above (and that's my fault from back in my work in the Spark project).

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

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by locating the Java API code that constructs collections and converts them to iterators, then trace how input partitions are evaluated; done means chaining iterator operations directly where possible so the first output element is available without eagerly evaluating the entire partition and spilling behavior is preserved.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.