fix: [branch-1.2] decode invalid UTF-8 in nested Parquet BINARY values read as strings (#7106) #7339
All Vouch review confidence checks passed
Residual risk 0.13 = Change Risk (0.50) × (1 − Review Confidence (0.74)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 1057 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.53 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.400
Real PR Conversation Timeline
3 items
Approved
Thanks @manuzhang. I compared the changed lines with 621b9ccdb4 and they match the source commit exactly. The docs link into parquet.md resolves on this branch. Approving. Please let the pending Spark SQL jobs finish before merging, and merge this one before #7340.
Thanks @manuzhang
andygrove
manuzhang
Which issue does this PR close?
Backport of #7106 to
branch-1.2. Part of #7032 (the nested values) and #4764.Rationale for this change
When a Parquet BINARY column without the UTF8 annotation is read as a string, through a read schema or
spark.sql.parquet.binaryAsString=true, the native scan converts nested values (struct fields, list elements, map keys and values) inparquet_convert_array. That fell through to Arrow's safe cast, which turns invalid UTF-8 into NULL, so those values silently became NULL where Spark keeps the bytes.branch-1.2has this bug. See #7106 for the full rationale.The fix also goes to
branch-1.1in #7340, opened together with this one. Per the backporting guide, #7340 should not merge before this one is ready.What changes are included in this PR?
The cherry-pick of 621b9ccdb4658ad2671e4e88e5c51da67e3c8fbc from
main, with one adaptation:native/core/src/parquet/parquet_support.rs: the import block conflicted becausemainalso importsSparkErrorthere (added after the 1.2 cut by the timestamp-overflow change). The backport only takes the newspark_castandSparkCastOptionsimports and leavesSparkErrorout, since nothing on this branch uses it.Everything else, including the docs changes to
compatibility/index.mdandparquet.md, applied cleanly.How are these changes tested?
The tests from #7106: the Rust unit tests in
parquet_support.rs,parquet_exec.rsandcast.rs, and the newParquetReadSuitetest "native scan decodes invalid UTF-8 in nested BINARY read as string".Locally on this branch:
cargo check --all-targets,cargo clippy --all-targets --workspace -- -D warningsandcargo fmt --checkinnative/pass.parquet_supportandparquet_exectests indatafusion-comet(28 tests) and thecasttests indatafusion-comet-spark-expr(111 tests) pass../mvnw test -Dtest=none -Dsuites="org.apache.comet.parquet.ParquetReadV1Suite native scan decodes"passes aftermake core.🤖 Generated with Claude Code