ilicmarkodb opened a new pull request, #57902:
URL: https://github.com/apache/spark/pull/57902

   ### What changes were proposed in this pull request?
   
   This PR applies default collation to casts whose target string type does not 
have an explicit
   collation, including analyzer-inserted implicit casts.
   
   It also updates view schema casts to use the stored schema with explicit 
UTF8_BINARY collation for
   non-collated string, char, and varchar fields. This keeps existing view 
columns from being
   reinterpreted when a view with non-binary default collation is resolved.
   
   The single-pass resolver path applies the same default-collation rewrite to 
cast nodes generated as
   child expressions by type coercion.
   
   
   ### Why are the changes needed?
   
   Views with a non-binary DEFAULT COLLATION apply that default to literals and 
string-producing
   expressions, but implicit casts to STRING could remain UTF8_BINARY. For 
example, a view expression
   like `lower(date_col)` should use the view default collation for the 
implicit cast to STRING.
   
   At the same time, schema-preserving casts added when resolving existing view 
columns must not inherit
   the view default collation. Those casts now target an explicit UTF8_BINARY 
schema for non-collated
   stored string columns.
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. In views and other objects with a non-binary default collation, 
analyzer-inserted implicit casts
   to default STRING now inherit the object default collation. Existing view 
columns whose stored schema
   contains non-collated STRING remain UTF8_BINARY when the view is resolved.
   
   
   ### How was this patch tested?
   
   Added regression coverage in `DefaultCollationTestSuite` for a view that 
keeps an existing table
   column as UTF8_BINARY while applying the view default collation to an 
implicit cast in `lower(d)`.
   
   Not run locally. Attempted `dev/scalafmt` on the changed Scala files, but 
Maven dependency
   resolution failed because the configured Maven mirror host
   `maven-central.storage-download.googleapis.com` could not be resolved.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Codex (GPT-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]

Reply via email to