delta-io / delta

An open-source storage framework that enables building a Lakehouse architecture with compute engines including Spark, PrestoDB, Flink, Trino, and Hive and APIs
https://delta.io
Apache License 2.0
7.62k stars 1.71k forks source link

[SPARK] Match collated StringType in TypeWideningMetadata #3832

Closed zhipengmao-db closed 3 weeks ago

zhipengmao-db commented 3 weeks ago

Which Delta project/connector is this regarding?

Description

Spark master introduced collated StringType. In TypeWideningMetadata.collectTypeChanges, we used to only match StringType instance, therefore if the type change is from/to StringType(collationId), which is expected and unrelated to type widening, we will throw an error typeWidening.unexpectedTypeChange. This PR fixes this by matching both collated and uncollated StringType when capturing string type changes.

How was this patch tested?

Existent tests.

Tests related to collations cannot be added as delta does not support collations yet.

Does this PR introduce any user-facing changes?

No.