Repository navigation
fix: [branch-1.2] apply the session's Comet configs in map stages of jobs outside a SQL execution (#7302) - #7337
Merged
Conversation
…a SQL execution (apache#7302) * fix: apply the session's Comet configs in map stages of jobs outside a SQL execution On an executor, SQLConf.get reads the task's local properties, which Spark fills with the session's configs only for jobs that run inside a SQL execution. A job launched from a query's RDD (Dataset.rdd with AQE off, QueryExecution.toRdd) runs its map stages outside one, and Spark's SQLExecutionRDD re-applies the session's configs only in the final stage. Comet reads its settings on the executor when it builds a native plan, so those map stages ran with every spark.comet.* setting at its default, including the memory pool and the configs passed to native. Capture the session's configs on the driver where Comet builds the RDDs and native shuffle that run native plans, and make them what SQLConf.get returns on the task thread while the plan is built, as SQLExecutionRDD does. Tasks inside a SQL execution are unchanged. Closes apache#7301. * refactor: capture only Comet configs once per shuffle and let configs Spark passed win Capture only spark.comet.* keys, and apply them only when no conf is set on the thread and the task got none of the session's Comet configs from Spark, so SQLExecution.withSQLConfPropagated still takes effect. Carry the native shuffle's one captured conf from its input RDD to the writer, apply it inside the serialized-plan getCometIterator, and drop the test workarounds this change makes redundant. * fix: apply the session's Comet configs to shuffle reads and test each native plan site A Comet shuffle read with no native plan above it in its stage, such as one feeding a Spark operator in an intermediate stage, still read Comet defaults. Capture the configs in CometShuffledBatchRDD and apply them in compute and computeAsShuffleBlockIterator, which makes the wrap in CometNativeShuffleInputRDD.compute redundant, so drop it. Make that RDD's sqlConf required so each call site captures on the driver explicitly. Replace the single test with one per site: the native shuffle writer, a native plan in a map stage, the native limit, the native top-K, each checking the memory pool every native plan resolves, and a shuffle read under spark.comet.shuffle.readBufferSize=0. * fix: apply the captured configs to the Celeborn frame size and capture DEBUG logs in tests The native Celeborn writer read spark.comet.shuffle.rss.maxFrameBytes in getWriter, before the writer applies the captured configs. Carry the configs on NativeShuffleSpec, which getWriter can reach through the dependency, and apply them to that read as well as in the writer, in place of CometNativeShuffleInputRDD and its iterator. Spark's LogAppender keeps INFO and above by default, so set its threshold to DEBUG for the memory pool line the tests read. --------- Co-authored-by: Andy Grove <[email protected]> (cherry picked from commit 15305af)
GitHub retires the macos-14 runner image on November 2, 2026 and is already cancelling jobs on it during scheduled brownouts. (cherry picked from commit 2d168e8)
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Backport of #7302 to
branch-1.2. #7302 closes #7301 onmain.Rationale for this change
A job launched from a query's RDD (
Dataset.rddwith AQE off,QueryExecution.toRdd) runs its map stages outside a SQL execution, so on an executor those stages ran with everyspark.comet.*setting at its default (memory pool, batch size, the configs passed to native), with no warning (#7301,bug).branch-1.2has this bug, so it needs the fix before 1.2.0 ships.branch-1.2is the newest release branch, so no newer branch needs a backport. #7302 carries only thebackport-1.2label, so nobranch-1.1backport is part of this.What changes are included in this PR?
git cherry-pick -x 15305af627of the squash commit of #7302. One conflict, in the import block ofCometNativeShuffleSuite.scala:branch-1.2already lacks theRangePartitioningimport thatmainstill has, so the resolution keepsbranch-1.2'sHashPartitioningimport and takes #7302's addedCometCollectLimitExecimport. The added and removed lines are otherwise identical to the source commit. See #7302 for the full description.How are these changes tested?
On this branch, with a
libcometbuilt from the pick (the fix is JVM-only):./mvnw test-compilepasses on the default profile (Spark 4.1) and on-Pspark-3.5.CometNativeShuffleSuite,CometJoinSuite,CometTaskMetricsSuite,NativeUtilSuiteandCometNativeShuffleInputRDDSuitepass: 235 succeeded, 0 failed. That includes the five new... outside a SQL execution uses the session's Comet configstests.I did not re-run the new tests without the fix on this branch (#7302 shows them failing before the change), and I did not run the Spark SQL test suites that #7302's CI ran.