← Back to Pull requests

fix: name the failing file in native Parquet scan errors #7788

Open
unknown opened this pull request with 478 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 30, 2026 01:11 UTC
Author

Which issue does this PR close?

Closes #7213.
Closes #4316.

Rationale for this change

When the native Parquet scan fails on a file, Spark's error should name that file. Today it often doesn't:

  • Read failures (#7213). A corrupt footer or page reaches the JNI boundary as a plain ParquetError. It is classified as CannotReadFile there, after the file's identity is gone, so the path is empty. The JVM then fills it with every file of the task, joined by commas. For a task reading healthy.parquet and corrupt.parquet, the error names both.

  • Schema conversion (#4316). ParquetSchemaConvert is raised by the schema adapter, which has no file identity, so the message reads Encountered error while reading file . with an empty path.
  • ParquetErrorContext already keeps each file's original Spark path beside that file's planners and streams. It only used the path for ParquetTimestampOverflow, and it was only installed when checked timestamp conversion was on.

    What changes are included in this PR?

  • with_scan_file_path in jni-bridge/src/errors.rs names a file in an error raised while scanning it:

  • - A bare ParquetSchemaConvert, ParquetMissingFieldIds or CannotReadFile without a path gets the file's path. A path the error already carries is kept.
    - ParquetTimestampOverflow always takes the scan's original Spark path, as before.
    - An unclassified read failure is classified with the same try_classify_file_read_error used at the JNI boundary, so only its path changes. Missing files, predicate failures inside the reader (ParquetError::External(ArrowError)), other Spark errors, and errors with query context surface unchanged.
  • ParquetErrorContext applies it to a file's planning errors (where footer reads fail), its pending planners, and its stream.

  • Every native Parquet scan installs ParquetErrorContext, not only those with checked timestamp conversion. The dynamic-filter code that rebuilds sources already looks through the wrapper and re-wraps.

  • The JVM's per-task file list fallback in SparkErrorConverter stays as a safety net for read failures raised outside a per-file scan. Its comment is updated.
  • How are these changes tested?

  • ParquetReadSuite:

  • - "native scan read failure names only the corrupt file of a multi-file task": a healthy, larger file and a corrupt one in the same task. The FAILED_READ_FILE error's path must be the corrupt file. On main it is healthy.parquet,corrupt.parquet.
    - "native scan schema conversion error names the file that cannot be converted": an INT file and a STRING file read as a int in one task. The error must name the STRING file and not the other. On main it reads Encountered error while reading file ..
    - Both fail against main's native library and pass with this change (Spark 4.1).
  • Rust unit tests:

  • - file_error_context.rs: a corrupt footer during planning and a corrupt page during streaming both become CannotReadFile naming the file; a schema conversion names its file.
    - errors.rs: paths fill only where missing, timestamp overflow takes the scan's path, and non-file errors are untouched.
  • Two dynamic-filter join tests downcast the scan straight to ParquetSource. They now use concrete_parquet_source, which looks through the wrapper.

  • Ran locally on Linux (WSL), Spark 4.1 and 3.5 profiles:

  • - cargo fmt and cargo clippy --all-targets -D warnings on the touched crates.
    - The datafusion-comet tests matching parquet and dynamic_filter (460 passed).
    - The jni-bridge lib tests. Four JVM-backed panic tests fail the same way on unmodified main without the JVM test classes on the classpath.
    - ParquetReadV1Suite ("native scan" and "TIMESTAMP_MILLIS" tests), CometExecSuite "native parquet read" tests, and SparkErrorConverterSuite.

    Diff: 478 lines (+358 / -120) across 5 files Reviewer: comphead Review duration: 1272m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.46) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 478 lines diff across 5 files
    0.46
    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%
    42%
    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.369
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #7788"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% 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: 45.8% (MEDIUM) · Higher = larger blast radius
    45.8%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 26.1% · Safe to merge
    26.1%