docs: correct which operators run separate native plans in a task - #6194
Conversation
The memory management and tuning guides said that a native shuffle runs the pre-shuffle operators and the shuffle writer as two native execution contexts in the same task. The shuffle writer is planned together with the native operators that feed it, so a native shuffle is one plan. List the operators that do split a task's native work into separate plans: union and coalesce, collect limit and take-ordered-and-project, and native Parquet and Iceberg writes.
sunchao
left a comment
There was a problem hiding this comment.
Summary
- Prior state and problem: Both guides incorrectly used native shuffle as an example of separate native plans sharing a task’s memory pool.
- Design approach: Explain shuffle’s fused writer plan and identify operators that introduce separate native plans.
- Correctness / compatibility analysis: Traced shuffle, union, coalesce, limit/top-K, Parquet and Iceberg write paths and task-shared pool creation. Compared relevant Spark sources for versions 3.4.3, 3.5.9, 4.0.4, 4.1.3 and 4.2.0. The revised examples are supported by the implementation.
- Key design decisions: Preserve the explanation of task-wide pool sharing and distinguish native-plan boundaries from Spark-task boundaries.
- Implementation sketch: Expand the contributor guide’s examples and replace the tuning guide’s shuffle example with union and coalesce.
- Behavioral changes worth calling out: This is documentation-only. It adds no runtime overhead or implementation abstractions.
- Suggested improvements: None at P1/P2 severity. No introduced P1/P2 issues found within this review.
Reviewed the entire base-relative diff from 67803a7a422c44de07af1e5d25c1dbeae8df68d4 to full SHA 7cb0006d76923aa8f6d4b21b95f2a6ec97df4cee: one commit affecting two documentation files. The PR remains open and non-draft. Existing reviews, issue comments, inline comments and review threads were empty in both the supplied snapshot and live GitHub.
Routed skills: review-comet-pr, review-comet-memory-pr and review-comet-shuffle-pr.
Exact-head CI: 7 successful checks and 15 skipped, with no failed or unfinished check runs. Preflight, Required Checks, change detection, title/label checks and CodeQL passed. Runtime builds, Spark SQL/Iceberg suites, benchmarks and site deployment were skipped.
Validation limits: Source inspection and git diff --check passed. No local JVM/native tests or documentation build were run. The author’s temporary instrumented measurements were not independently reproduced.
Resolve the tuning.md conflict with apache#6194's wording for the paragraph on pools shared by a task's native plans. Both sides removed the incorrect claim that a native shuffle runs two native plans; apache#6194 also names the operators that do run separate plans. # Conflicts: # docs/source/user-guide/latest/tuning.md
Which issue does this PR close?
No issue was filed. This is a small documentation correction found while working on #6191.
Rationale for this change
The memory management guide and the tuning guide both say that a native shuffle runs the pre-shuffle operators and the shuffle writer as two native execution contexts in the same task, and use that to explain why the memory pool is shared per task. That stopped being true with #4507, which plans the shuffle writer together with the native operators that feed it.
I checked this by counting the native plans each task created, using a temporary print where
CometExecIteratorcreates its plan, on the default Spark 4.1 build:coalesce(1), aggregatemapthat Comet does not support, then an aggregatemapstays in SparkWhat changes are included in this PR?
How are these changes tested?
This is a documentation-only change. The counts above come from a temporary instrumented run that is not part of this PR. The collect limit, take-ordered-and-project and Iceberg write cases were checked in the code rather than measured.