← Back to Pull requests

fix: apply the session's Comet configs in map stages of jobs outside a SQL execution #7302

Closed
unknown closed this pull request without merging on Oct 30, 2026 13:56 UTC
View on GitHub
unknown unknown commented on Oct 28, 2026 15:51 UTC
Author

Which issue does this PR close?

Closes #7301.

Rationale for this change

A job launched from a query's RDD (Dataset.rdd with AQE off, QueryExecution.toRdd with AQE on or off) runs its map stages outside a SQL execution. On an executor, SQLConf.get then reads task local properties that Spark has not filled, and SQLExecutionRDD (SPARK-28939) re-applies the session's configs only in the final stage. Comet reads its settings on the executor when it builds a native plan and when it reads a shuffle, so those map stages ran with every spark.comet. setting at its default. That includes the memory pool, the batch size and the configs passed to native. There was no warning.

What changes are included in this PR?

  • CapturedSQLConf captures the session's spark.comet. configs on the driver. withConf makes them what SQLConf.get returns on the task thread, using SQLConf.withExistingConf as SQLExecutionRDD does. It does nothing when a conf is already set on the thread, or when Spark passed the task the session's configs as local properties (inside a SQL execution, or under SQLExecution.withSQLConfPropagated).

  • It applies where Comet builds native plans or reads shuffles on executors: CometExecRDD.compute, the native shuffle writer and the Celeborn writer's frame size (the configs ride on NativeShuffleSpec), the serialized-plan CometExec.getCometIterator used by the native limit and top-K, and CometShuffledBatchRDD.compute / computeAsShuffleBlockIterator.

  • The withSQLConfPropagated workarounds in CometJoinSuite and CometTaskMetricsSuite are no longer needed and are removed.
  • Not covered here: the JVM columnar shuffle writers, tracked in #7303. CometColumnarShuffleSuite keeps its workaround until then. Native writes run inside a SQL execution, so they are not affected.

    How are these changes tested?

    New CometNativeShuffleSuite tests run a query from its RDD with AQE off, one per site:

  • the native shuffle writer, a native plan in a map stage feeding the JVM shuffle, the native limit, and the native top-K each check, from the line CometExecIterator logs when it creates a plan, that every native plan resolved the session's memory pool

  • a Comet shuffle read in an intermediate stage under Spark operators runs with spark.comet.shuffle.readBufferSize=0, which fails only if the read sees the session's value
  • The same query shapes in spark-shell (Spark 4.1.1): before this change, map-stage plans resolve fair_unified and the intermediate shuffle read succeeds. After it, every plan resolves the session's greedy_unified and the read fails as collect() does. The probe from #7301 resolves the submitted pool and fraction in the map stage in all five scenarios.

    Diff: 344 lines (+258 / -86) across 4 files Reviewer: rich7420 Review duration: 2764m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.66) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.66 · 344 lines diff across 4 files
    0.66
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.350
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #7302"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 65.5% (HIGH) · Higher = larger blast radius
    65.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.9% · Safe to merge
    25.9%