stevomitric opened a new pull request, #60060: URL: https://github.com/apache/spark/pull/60060
### What changes were proposed in this pull request? Add a `VariantGet` case to `CollationTypeCoercion.collationStrengthBaseCases`: when the target type has a non-UTF8_BINARY collation, its collation context is the target type with Implicit strength, like a column of that type. Plain `STRING` targets are unchanged. ### Why are the changes needed? Without this case, `VariantGet` took the collation context of its path literal (Default, UTF8_BINARY), so the analyzer cast the result back to UTF8_BINARY when comparing it with a string literal. This silently gives wrong results: ```sql -- status values: 'Open', 'open', 'OPEN', 'closed' SELECT id FROM t WHERE variant_get(v, '$.status', 'string collate UTF8_LCASE') = 'open'; -- before: 2, after: 1, 2, 3 ``` ### Does this PR introduce _any_ user-facing change? Yes. `variant_get` / `try_variant_get` with a collated target type now use that collation in comparisons and string functions. ### How was this patch tested? - New test in `CollationTypePrecedenceSuite`. - Existing collation and variant suites pass. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Isaac (Claude Opus 5.5) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
