← Back to Pull requests

feat: run admitted native Parquet scans as one local graph #7692

Open
unknown opened this pull request with 392 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 19, 2026 18:58 UTC
Author

Which issue does this PR close?

Part of #6499 (step 2). Builds on #6883.

Rationale for this change

#6883 runs a query as one local DataFusion graph only when its leaf is a range. Step 2 of #6499 admits exchange-free plans over Comet's native Parquet scan (scan, filter, project), judged from the plan CometExecRule produces, whether or not AQE is enabled.

What changes are included in this PR?

Admission (CometLocalRule)

  • The block's single leaf may now be a CometNativeScanExec. The scan is declined when it reports partitioning (a bucketed or key-grouped scan) or reads encrypted files, since decryption needs the JVM.

  • A plan whose expressions contain a physical subquery (PlanExpression, for example a scalar subquery or dynamic pruning in a scan's filters) is declined. These are not in the serialized plan, so the existing JVM-callback check on the plan does not see them.

  • A scan's file partitions are listed only when the query runs, as in ordinary execution. So CometLocalExec builds its spec at execution time, after resolving the scan's subqueries. When there are no partitions, or more than 1024, collect runs as ordinary Comet execution.

  • The result node copies the block's logical link. Without it, spark.sql.adaptive.forceApply failed with an internal error when AQE made the result its final stage. This also affected range plans from #6883.
  • Native

  • createQuery takes each partition's serialized NativeScan with its files, which is the same data a Spark task receives. A partition's files are injected into a copy of the plan when that partition is planned. The ordinary planner and the protobuf are unchanged.

  • native/local now plans and starts each partition on the runtime's blocking pool. This is needed because creating an S3 object store blocks on Comet's runtime, which panics on a worker. The started stream is stored from the blocking thread, so cancellation still drops it synchronously.

  • The query records which partition's turn it was when it failed. The JVM uses this to name that partition's files when a native read error carries no file path, as ordinary execution names the failing task's files.
  • The contributor guide page local-execution.md is updated. One known gap is documented there: a local scan reports no task input metrics.

    How are these changes tested?

  • native/local: new tests for a partition start that blocks on the runtime, a start that panics, and the partition reported for an error.

  • native/core (local::): each partition reads only its own Parquet files, an empty file group yields an empty partition, and file lists that do not match the plan are rejected.

  • CometLocalExecutionSuite: Parquet scans split into many partitions are compared with Spark's results and row order. Further tests cover:

  • - partition pruning;
    - scans of no files or of more than 1024 partitions;
    - declined bucketed, encrypted and subquery plans;
    - AQE on, off and forceApply (range and scan);
    - cached and RDD partition counts;
    - a corrupt file named in the error;
    - explain before files are listed.

    Diff: 392 lines (+294 / -98) across 4 files Reviewer: viirya Review duration: 15909m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 392 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.357
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #7692"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    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: 43.1% (MEDIUM) · Higher = larger blast radius
    43.1%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 23.0% · Safe to merge
    23.0%