Skip to content

[SPARK-56045][SQL] Add flag for ignoring Parquet UNKNOWN type annotation and revert to old behavior#54870

Open
ZiyaZa wants to merge 2 commits intoapache:masterfrom
ZiyaZa:unknown-type-flag
Open

[SPARK-56045][SQL] Add flag for ignoring Parquet UNKNOWN type annotation and revert to old behavior#54870
ZiyaZa wants to merge 2 commits intoapache:masterfrom
ZiyaZa:unknown-type-flag

Conversation

@ZiyaZa
Copy link
Contributor

@ZiyaZa ZiyaZa commented Mar 17, 2026

What changes were proposed in this pull request?

This PR introduces a new flag spark.sql.parquet.reader.respectUnknownTypeAnnotation.enabled for Parquet reader to control the behavior when it reads an external file with UNKNOWN logical type annotation:

  • (Default) When false, we infer the Spark type based on the physical type used in the Parquet file, as we did before Spark 4.1.
  • When true, we use NullType as the Spark type.

Why are the changes needed?

To fix the regression introduced by #52922, as we have been reading files differently since then.

Does this PR introduce any user-facing change?

Yes. With default flag value, when we read a Parquet file written by an external engine:

  • Before, we inferred NullType
  • Now, we'll infer a type based on the physical type (e.g. IntegerType)

How was this patch tested?

Added tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@cloud-fan
Copy link
Contributor

LGTM if CI is green, please create a new JIRA ticket as the original commit is already released.

@ZiyaZa ZiyaZa changed the title [SPARK-54220][SQL][FOLLOWUP] Add flag for ignoring Parquet UNKNOWN type annotation and revert to old behavior [SPARK-56045][SQL] Add flag for ignoring Parquet UNKNOWN type annotation and revert to old behavior Mar 18, 2026
@ZiyaZa
Copy link
Contributor Author

ZiyaZa commented Mar 18, 2026

LGTM if CI is green, please create a new JIRA ticket as the original commit is already released.

CI is green, linked the new ticket in the title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants