Repository navigation
docs: add a documentation style guide and apply it to the remaining pages - #7151
Abhishek-Mohan wants to merge 18 commits into
Conversation
a088151 to
03723eb
Compare
03723eb to
7cce988
Compare
9d5fadf to
0151778
Compare
fd74821 to
0cc4995
Compare
Add docs/source/contributor-guide/style_guide.md, which writes down the vocabulary from apache#4419 (pipeline membership, implementation language and data format), the rule for "native", how to name operators in prose, and the page conventions that the docs-review skill in apache#4420 cites. Each rule has a stable ID so that reviews can cite it. The guide follows the code where apache#4419 and the code differ: "Hybrid" keeps the meaning it already has in expressions.md, expressions are described separately from plan nodes, and "Arrow-native" is a claim about data format only. The Generated Content section names the generated text exactly, by the markers GenerateDocs fills in, including the config tables built from QueryPlanSerde and contrib config classes, and the cast tables built from CometCast. P18 covers attribution of third-party content, which apache#4420 lists among its checks. The guide's scope covers .doc strings in contrib config classes, and its vocabulary and accuracy rules also apply to doc comments, AGENTS.md and agent skills. Link the page from the contributor guide toctree and from AGENTS.md. Part of apache#4419. Generated-by: OpenCode
Correct statements in plugin_overview.md that no longer match the code: - CometSparkSessionExtensions registers more than CometRule: it also registers rules that run after columnar transitions are inserted, AQE query stage optimizer rules on Spark 3.5 and later, and IcebergWriteStrategy. - Comet does replace part of a query stage, and an unsupported operator stays in Spark, not the whole plan. Describe the post-transition rules in the order CometRule runs them: RevertNativeForTransitionHeavyStages first, which can decline an unsafe revert, then EliminateRedundantTransitions, which uses CometColumnarToRowExec, or CometNativeColumnarToRowExec when that opt-in config is set and the converter supports the schema. - Not every leaf of the Rust plan is a ScanExec. ScanExec takes Arrow batches from the JVM; a direct shuffle read of a Comet shuffle with supported types is a ShuffleScanExec; the Parquet, Iceberg and CSV scans read their files in Rust. - Blocks are formed from consecutive CometNativeExec operators, except that the write operators start a new block for their child. The native shuffle writer absorbs a CometNativeExec child. Add a paragraph on the JVM codegen dispatcher, which apache#4419 asks this page to cover: some expressions in a Rust plan run Spark's generated JVM code over Arrow batches through JNI, and the operator around them stays in the Comet pipeline. Scala and Java UDFs take the same path. Also replace the vague uses of "native" with the apache#4419 terms. The scan section (Phase 1) is left alone, because apache#6052 rewrites it. Part of apache#4419. Generated-by: OpenCode
Replace vague uses of "native" in native_shuffle.md. Native shuffle accepts any CometPlan child, so call the child a Comet operator rather than a native one. Where "native" was used as a noun, name the Rust component instead. Also correct statements this touched: - When RevertNativeForTransitionHeavyStages restores a stage, a native shuffle whose input came from spark.comet.convert.shuffleInput.enabled switches back to JVM columnar shuffle. - When direct read cannot serve a shuffle stage, the stage stays as it is and the operators that read it cannot join a Rust plan. The check is QueryPlanSerde.supportedDataType; supportedSinkDataType does not exist. - Drop the unverified reason given for rejecting nested range keys. - Describe spark.comet.shuffle.directRead.enabled the same way as the JVM shuffle guide. Contributor-guide forms such as "native code" and "native plan", the "native shuffle" name, and config keys are unchanged. Part of apache#4419. Generated-by: OpenCode
Replace vague uses of "native" in jvm_shuffle.md. Say which parts of JVM shuffle run on the JVM (partitioning) and which run in Rust (Arrow IPC encoding), and call a shuffle's child a Comet operator, since native shuffle accepts any CometPlan child, including JVM-side ones. Say that direct read applies when a Comet block reads the shuffle as a ShuffleScan input. Also describe spark.comet.shuffle.directRead.enabled accurately: both read paths decode in Rust, and direct read decodes inside the Rust plan, bypassing Arrow FFI, as the config's own doc string says. Part of apache#4419. Generated-by: OpenCode
Replace vague uses of "native" with the term each sentence means: the Comet pipeline, Rust, or Velox on the Gluten side. Describe Velox and DataFusion as columnar query engines rather than vectorized ones. Two factual fixes came up while rewording: - The table formats section said Comet has no Delta Lake integration. main now has an experimental, opt-in Delta Lake scan (apache#5365), so say that and link the Delta Lake guide. - Link the compatibility guide by its path in the docs rather than by its published URL, and point the two Gluten limitations links, which return 404, at the page in Gluten's v1.7.0 sources. Part of apache#4419. Generated-by: OpenCode
apache#4650 rewrote this page. Fix the uses of "native" that remain: say "Rust" where the text means the Rust implementation or the Rust plan, "in the Comet pipeline" where it means Comet as a whole, and "Spark's built-in shuffle" instead of "Spark's native shuffle". Config keys, API names, and quoted explain output are unchanged. Also say that consecutive Rust-implemented operators are usually, not always, combined into one block, and add CometTakeOrderedAndProject to the exceptions: it runs its own final Rust plan, after a single-partition shuffle when its input has several partitions. Two small fixes on the same page: the explain section documents seven configs, not five, so add the missing spark.comet.explain.planOnly.enabled and spark.comet.explain.rules rows to its table; and CometCollectLimit is not purely JVM-side, since it runs Rust limit plans unless Spark collects it at the plan root, so say so and adjust the JVM-side section's intro. prettier realigns the Scans table because two of its rows changed. Part of apache#4419. Generated-by: OpenCode
Use the apache#4419 terminology on docs/source/index.md, which the README rewrite in apache#4428 did not cover. The page now says what Comet does with DataFusion rather than calling it a native engine, and the opening line carries the README's Arrow framing, as apache#4419 asks. Say that Comet hands DataFusion the operators it runs in Rust, not all supported operators, since some run on the JVM. Also drop "powerful" from the edited paragraph, and link the benchmarking guide by its relative path rather than its published URL. Part of apache#4419. Generated-by: OpenCode
0cc4995 to
56396e3
Compare
sunchao
left a comment
There was a problem hiding this comment.
Reviewed all seven commits and nine changed files at 56396e38e2dd066e01256201b6b3dc4772dec970 against base 2b1c6a3938cbe1c4b2d0aa6383e64360569f877a. The full PR diff contains documentation changes only. I verified four new P2 findings. The PR has no existing reviews, conversation comments, or review threads.
Summary
- Prior state and problem
The guides used “native” for both work handled by Comet and work executed in Rust. The plugin overview also said a query stage could convert only as a whole. - Design approach
The style guide distinguishes which engine handles an operation, which language executes it, and which format carries its data. The revised pages apply those distinctions to plans, shuffles, and expression dispatch. - Correctness
A non-adaptive final aggregate can read a Comet shuffle throughScanExecwith direct reads enabled. Separately, a stage can revert to Spark without appearing in thespark.comet.explain.ruleslog. Both cases contradict new documentation. - Compatibility analysis
Spark 3.4.3, 3.5.9, 4.0.4, 4.1.3, and 4.2.0 sources confirm the documented transition ordering and collect-limit behavior. The AQE stage optimizer hook is present from Spark 3.5. Celeborn adds a child-class restriction missing from the revised shuffle eligibility rule. - Key design decisions
The guide preserves printed operator names and the shippedHybridexpression classification. A JVM-dispatched expression can remain inside a Rust-implemented operator. - Implementation sketch
AGENTS.mdand the contributor index link the new guide. The plugin overview, both shuffle guides, plan reference, Gluten comparison, and landing page adopt its terminology. - Performance
The patch adds no query execution overhead. Its JVM shuffle diagram does overstate the cost for a row-forwarding bridge. The probe consumed two rows with zero Arrow batches produced by the bridge. - Design
Linking to the existing operator reference and identifying the inputs toGenerateDocsgives contributors one place to verify plan names and generated content. - Abstraction & complexity
CometPlanidentifies membership in the Comet pipeline. Predicting shuffle behavior also requires the manager’s selection rule and the child’sdoExecute()implementation. - Behavioral changes worth calling out
Compared withbranch-1.2, the PR changes contributor and user guidance. It documents partial-stage conversion, the separate final Rust plan for multi-partition top-K, and the experimental opt-in Delta scan. - Suggested improvements
Qualify direct reads by the serializedShuffleScanleaf, distinguish Celeborn’s child requirement, show the JVM bridge’s row path, and narrow the rule-logging guarantee.
Routed skills. review-comet-pr, review-comet-shuffle-pr, review-comet-ffi-pr, review-comet-expression-pr, review-comet-memory-pr, and review-comet-iceberg-write-pr.
Exact-head CI. Label pull requests passed. Comet CI, CodeQL, and Check PR Title each reported action_required with zero jobs executed. Comet CI run
Validation. Focused Spark 4.1.3 probes exercised shuffle serialization, manager selection, JVM row consumption, and rule logging. Sphinx 7.4.7 built the head and merge base with the same 80 warnings. All eight changed documentation pages rendered, and all 52 local article links checked resolved. Validation excluded full Spark/native suites, live Celeborn I/O, release-document assembly, and Mermaid rendering.
- plugin_overview.md: a shuffle input is a ShuffleScanExec only when it is serialized as a ShuffleScan leaf, which needs direct read, an AQE query stage, and supported output types. Without AQE, the shuffle is read through ScanExec. - understanding-comet-plans.md: spark.comet.explain.rules logs the plan before and after CometScanRule, CometExecRule and EliminateRedundantTransitions, not stage reverts. Point to spark.comet.explain.fallback.log.enabled for those. - jvm_shuffle.md: scope the columnar-to-row diagram to children that produce Arrow batches. A CometSparkToColumnarExec child returns its input rows directly. - native_shuffle.md: with the Celeborn shuffle manager, native shuffle needs a CometNativeExec child, not any CometPlan. Part of apache#4419. Generated-by: OpenCode
|
Note 🤖 Claude Opus 5.5 responding on behalf of @Abhishek-Mohan @sunchao all four findings are fixed in 3c982c8, and |
| Spark are disabled by default, but users can opt in. See the [Comet Compatibility Guide] for more information. | ||
|
|
||
| [Comet Compatibility Guide]: https://datafusion.apache.org/comet/user-guide/latest/compatibility/index.html | ||
| [Comet Compatibility Guide]: /user-guide/latest/compatibility/index.md |
There was a problem hiding this comment.
Changing this link format may affect how the site gets published?
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of @Abhishek-Mohan
No effect on publishing. Sphinx resolves /user-guide/latest/compatibility/index.md to the relative link ../user-guide/latest/compatibility/index.html in the built page, the same form main already uses for four other links on this page. A base-vs-head docs build shows no new warnings, and the build now warns if the target page moves.
|
This looks great @Abhishek-Mohan. I've been reviewing the changes manually. Will finish reviewing tomorrow! |
comphead
left a comment
There was a problem hiding this comment.
I checked the rewritten paragraphs against the code at this head, and the transition rules, the write-block exception, the explain configs and the renamed operators all match. Three leftovers outside the diff, so no inline comments. In plugin_overview.md the Shuffle Reads paragraph (lines 202 to 204) still says the compressed blocks go to the plan whenever a native plan consumes the shuffle and spark.comet.shuffle.directRead.enabled is on, while the rewritten paragraph at lines 156 to 163 now requires a ShuffleScan leaf, which needs an AQE shuffle query stage. Could it use the same condition, as the jvm_shuffle.md sentence already does? The overview figure comet-overview.svg still says "Apache DataFusion native engine" and "Native plan", which the new alt text and the guide's own "Before" example move away from. Line 81 of index.md still says "seamlessly", which P10 lists as a marketing word.
… the home page The Shuffle Reads paragraph in plugin_overview.md now gives the same ShuffleScan condition as the paragraph above it and jvm_shuffle.md. The overview figure and the index.md compatibility blurb write Rust instead of native (N3) and drop seamlessly (P10). Generated-by: OpenCode
…igure labels CometCollectLimit takes rows on the JVM for collect, show and take, through executeCollect, and runs Rust limit plans otherwise; where it sits in the plan does not decide this. The overview figure no longer says every supported operator runs in Rust (CometUnion does not), and drops vectorized as a synonym for columnar (T10). Generated-by: OpenCode
… the Gluten page With the Celeborn shuffle manager, native shuffle also needs spark.comet.shuffle.mode=native and the manager's own support checks (cometCelebornShuffleFallbackReason), not only a CometNativeExec child. Two changed lines on the Gluten page now address the reader (P9). Generated-by: OpenCode
N1 now covers every form of the banned phrases, such as ran natively and Comet-native. N2 allows the native shuffle path without pairing it with JVM shuffle. N3 replaces and similar with a test, names user-guide/, and says pages outside the contributor guide allow only the N2 compounds. Agents running the guide could not apply the old wording consistently. Generated-by: OpenCode
…or a fused block Under Adaptive Query Execution, CometRule also runs as the columnar rule on each new query stage, not only as a stage preparation rule. The Celeborn condition names nativeShuffleFallbackReason, which holds the manager's checks, instead of a user-guide section that only covers released clients. The pages already say Rust plan for a group of operators that run together in Rust, so the three Comet block mentions use it too. Generated-by: OpenCode
T7 lists Arrow-native, which N3's limit to N2 compounds outside the contributor guide would otherwise forbid. N3 also says any other use of native is a finding, so a phrase outside the lists has an outcome. Generated-by: OpenCode
A dry run read native cache scan as allowed by N2, but the in-memory cache scan runs on the JVM. N2 now says the scan and writer compounds apply only to Rust-implemented ones. Generated-by: OpenCode
A dry run rewrote "falls back to its native execution" and "executes natively (not falling back to Spark)" wrongly, because N1 offered only T1 or T3. N1 now says not falling back is T1, since codegen dispatch is not a fallback, and that Spark's own behavior is N5. Generated-by: OpenCode
…ame, keep the N5 test case stable The merge-base step now tries again after deepening and stops with an error if there is still no base. Branch names with a slash no longer break the state file path. The N5 case moves to the scratch page, so it holds before and after apache#7151 rewrites understanding-comet-plans.md. Generated-by: OpenCode
|
Note 🤖 Claude Opus 5.5 responding on behalf of @Abhishek-Mohan @comphead all three fixed in 60af6cb: the Shuffle Reads paragraph uses the |
Which issue does this PR close?
Part of #4419. Operator renames are left for a separate issue, because they change plan output and test files (see my comment on #4419).
Rationale for this change
#4419 proposes a shared vocabulary for Comet's docs, mainly replacing vague uses of "native" with specific terms. The README and several user guides already use it (#4428, #4650, #4651, #4652), but the rules exist only in the issue, and several pages still use the old wording.
This PR writes the rules down as a style guide and applies them to the remaining pages that #4419 lists. Each page is its own commit, so you can review one commit at a time, or I can split the PR if you'd prefer.
How this PR covers #4419
gluten_comparison.mdREADME.mddocs/source/index.mdscala_java_udfs.mdmainunderstanding-comet-plans.mdplugin_overview.md: "Rust-implemented operators", and how JVM Arrow expressions fit into the pipelinenative_shuffle.mdandjvm_shuffle.mdgluten_comparison.md: the JVM-on-Arrow path as a differentiatorDeliberate departures, explained in my comment on #4419:
What changes are included in this PR?
1. Style guide (
docs/source/contributor-guide/style_guide.md), linked from the Reference section of the contributor guide and fromAGENTS.md:Every rule has a stable ID so reviews and the #4420 skill (#7153) can cite it.
Where #4419 and the current code differ, the guide follows the code:
expressions.md: an expression with both a Rust path and a codegen-dispatch path.2. Page cleanups, one commit per page:
contributor-guide/plugin_overview.mdcontributor-guide/native_shuffle.mdCometPlanchild. "native" used as a noun → the component it means. Also: the revert exception for converted shuffle input, and what happens when direct read can't serve a stagecontributor-guide/jvm_shuffle.mdspark.comet.shuffle.directRead.enableddescriptionabout/gluten_comparison.mduser-guide/latest/understanding-comet-plans.mdCometTakeOrderedAndProjectas another exception to single-block fusion. Also: the explain section says seven configs and adds the missingspark.comet.explain.planOnly.enabledandspark.comet.explain.rulesrows, and theCometCollectLimitrow says it runs Rust limit plans unless Spark collects it at the plan rootindex.md(landing page)Corrections in
plugin_overview.md, which need the closest review:CometSparkSessionExtensionsalso registers post-transition rules, AQE stage optimizer rules on Spark 3.5 and later, andIcebergWriteStrategy.RevertNativeForTransitionHeavyStagesruns first. It can revert a transition-heavy stage whenspark.comet.exec.transitionRevert.enabledis set, unless reverting it is unsafe. ThenEliminateRedundantTransitionsturns the remaining transitions intoCometColumnarToRowExec, or into the RustCometNativeColumnarToRowExecwhen that opt-in config is set.ScanExectakes Arrow batches from the JVM through the C Stream.ShuffleScanExec.JvmScalarUdfExpr→CometUdfBridge→CometScalaUDFCodegen, over Arrow through JNI. Scala and Java UDFs take the same path, and the operator stays Rust-implemented.CometNativeExecoperators, except that the write operators start a new block for their child. The native shuffle writer takes in aCometNativeExecchild.Config keys, class names, and quoted explain output are unchanged on every page.
Overlap with open PRs:
plugin_overview.md, so this PR leaves that section as it is.user-guide/latesttouser-guide/dev. The guide's links uselatesttoday, and I'll update them if docs: publish the newest release at user-guide/latest and main at user-guide/dev #7112 lands first.understanding-comet-plans.md, which this PR realigns, so the two conflict.AGENTS.md, and the contributor index.I'll rebase whichever lands first.
Not included:
from_unixtimeexample;CometBatchScanrow;plugin_overview.md.contributing.md, which I'll add after docs: add AI-assisted contributions page to the contributor guide #6734 merges.How are these changes tested?
Docs only.
prettier --checkpasses on every changed file.main. Five independent AI reviews (GPT-6 Astra, Grok 4.7, Gemini 4 Argon, Claude Opus 5.5, GPT-6.1 Sol) checked them against the code. Over two rounds, each finding was either fixed or listed under Not included.Council review
Each round, seven models ran dry runs: they followed the style guide literally as an agent would, rewrote pages with it, and ran the review skill on this branch. Findings were checked against the code before fixing. Models already at 10/10 on both PRs were not rerun in round 4.
Rounds: 4
AI assistance: OpenCode helped draft the guide and the edits and checked them against the code. The reviews above were run with OpenCode subagents.