[SQL] Reject incompatible Parquet row reader conversions - #58496
Open
Jiayi-Wang-db wants to merge 1 commit into
Open
[SQL] Reject incompatible Parquet row reader conversions#58496Jiayi-Wang-db wants to merge 1 commit into
Jiayi-Wang-db wants to merge 1 commit into
Conversation
uros-b
reviewed
Sep 4, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
Thank you for the PR @Jiayi-Wang-db, could you please make a Spark Jira ticket for this change? Please see: https://issues.apache.org/jira/projects/SPARK/
Also, could you please enable GHA / GitHub Actions workflows (please see "Pull request" in https://spark.apache.org/contributing.html)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Make the Parquet row-based reader reject two incompatible primitive type conversions that the
vectorized reader already rejects:
FIXED_LEN_BYTE_ARRAYto Spark SQLSTRINGINT32annotated asDATEto Spark SQLDECIMALThe row converter now accepts
INT32andINT64as decimals only when their logical annotationis decimal, absent, or a signed integer annotation. Unsupported conversions raise
SchemaColumnConvertNotSupportedException, consistently with the vectorized reader.This follows the conversion semantics established by SPARK-34212 and SPARK-40876. The earlier
SPARK-32317 / PR #29600 discussion proposed a broader configurable conversion matrix but was not
merged.
Closes #58495.
Why are the changes needed?
The row-based reader currently ignores incompatible logical and physical type combinations. It
interprets a
DATEvalue as an unannotated integer-backed decimal and interprets arbitraryfixed-length bytes as UTF-8. This can silently return incorrect data, while reading the same file
and requested schema with the vectorized reader fails with a Parquet column type mismatch.
Both readers should reject these unsupported conversions instead of producing reader-dependent
results.
Does this PR introduce any user-facing change?
Yes. When the vectorized Parquet reader is disabled, the two unsupported schema conversions above
now fail with
FAILED_READ_FILE.PARQUET_COLUMN_DATA_TYPE_MISMATCHinstead of returning incorrectlyinterpreted values. Supported binary-to-string and integer-to-decimal conversions are unchanged.
How was this patch tested?
Added an end-to-end test in
ParquetIOSuitethat writes raw Parquet schemas for both incompatibleconversions and verifies that the row-based and vectorized readers return the same error condition.
The focused test command was attempted locally:
Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-5)