Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-47904][SQL] Preserve case in Avro schema when using enableStab…
…leIdentifiersForUnionType ### What changes were proposed in this pull request? When `enableStableIdentifiersForUnionType` is enabled, all of the types are lowercased which creates a problem when field types are case-sensitive: Union type with fields: ``` Schema.createEnum("myENUM", "", null, List[String]("E1", "e2").asJava), Schema.createRecord("myRecord2", "", null, false, List[Schema.Field](new Schema.Field("F", Schema.create(Type.FLOAT))).asJava) ``` would become ``` struct<member_myenum: string, member_myrecord2: struct<f: float>> ``` but instead should be ``` struct<member_myENUM: string, member_myRecord2: struct<F: float>> ``` ### Why are the changes needed? Fixes a bug of lowercasing the field name (the type portion). ### Does this PR introduce _any_ user-facing change? Yes, if a user enables `enableStableIdentifiersForUnionType` and has Union types, all fields will preserve the case. Previously, the field names would be all in lowercase. ### How was this patch tested? I added a test case to verify the new field names. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#46126 from sadikovi/SPARK-47904. Authored-by: Ivan Sadikov <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
- Loading branch information