← Back to Pull requests

fix: fall back to Spark for timestamp arrays when Parquet encryption is configured #7720

Open
unknown opened this pull request with 324 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 20, 2026 22:19 UTC
Author

Which issue does this PR close?

Part of #7029. I suggest landing #7148 first. It fixes the reported legacy list layouts for scans without Parquet modular encryption configured. This PR covers scans with modular encryption configured. On rebase after #7148, this PR can remove the warning for those layouts from “Reads that differ from Spark” and link the fallback entry directly to #7029.

Rationale for this change

In a legacy list, Spark can store an INT96 timestamp at at.bag.array. DataFusion 55.2.0 looks for at.list.array, misses the leaf, and decodes it as nanoseconds. A value such as 9999-12-31 23:59:59 overflows before Comet can cast it to microseconds.

The footer rewrite in #7148 would drop the file decryptor, so that PR skips the rewrite whenever the reader has decryption properties. Comet supplies those properties for every file when modular encryption is configured.

DataFusion fixed the lookup on main in apache/datafusion#26464. The 56.0.0 release targeted by #7249 still assumes a .list. path. I found no request for a 56.x backport on the DataFusion GitHub tracker. We can remove the fallback once Comet pins a release containing the fix. DataFusion 56.0.0 lookup

What changes are included in this PR?

CometScanRule leaves the scan with Spark when modular encryption is configured and the required schema includes a timestamp beneath an array. The check looks through structs, nested arrays and map keys and values, for both timestamp and timestamp_ntz. Pruning the affected field allows Comet to scan other columns in the same file.

The planner sees the projected Spark types before it knows each file's encoding. The fallback therefore also covers standard arrays, INT64 timestamp encodings and plaintext files in these scans. The user guide records that scope.

How are these changes tested?

A new ParquetEncryptionITCase test writes a uniformly encrypted Parquet file with Spark's legacy list layout and INT96 encoding. It verifies the encrypted footer, compares a year-9999 timestamp nested in a map of arrays of structs with Spark, and checks the fallback reason. A second projection of the same file reads a scalar timestamp and an integer array, checks the values against Spark, and requires CometNativeScanExec.

git diff --check passed. The regression runs in the hosted Linux scan suite. Fork CI

Diff: 324 lines (+243 / -81) across 4 files Reviewer: viirya Review duration: 14267m
All Vouch review confidence checks passed
Residual risk 0.35 = Change Risk (0.65) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 324 lines diff across 4 files
0.65
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.346
Shallow Review Depth shallow_review_depth
0.344
Sensitive Paths sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #7720"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% 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.2% (HIGH) · Higher = larger blast radius
65.2%
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: 34.7% · Safe to merge
34.7%