shivadarshan-devadiga commented on PR #60756:
URL: https://github.com/apache/spark/pull/60756#issuecomment-7064885909

   Thanks @gengliangwang, all three are fixed in this push. While on them, I 
went through the rest of the change again and fixed what I found. Most of it is 
in the same areas:
   - **Widening casts.** They keep CHAR and VARCHAR types only where the set 
operation can actually pad the children to the same lengths. Where it can't, 
they drop them as before this PR, for example VARCHAR(3) against VARCHAR(10), 
different CHAR lengths in a map, or a child without a raw type.
   - **Subquery comparisons.**
     - A scalar subquery in an `IN` list of constants is padded as `=` is.
     - Any string constant in an IN subquery is padded, not only a literal.
     - A comparison whose types don't match is left to CheckAnalysis.
     - A scalar subquery is padded only for a CHAR column itself, so a struct 
isn't read once per field.
   - **Views with `WITH SCHEMA TYPE EVOLUTION`.** They now evolve to the widest 
CHAR length: a column the narrowing had to narrow is stored with the query's 
CHAR type. A failure to store it doesn't fail the read, since the narrowing 
already returns it as stored.
   - **Legacy flag and migration guide.** A new internal 
`spark.sql.legacy.noCharWideningInSetOperations` (session-bound, so it reaches 
view bodies) restores the earlier behavior, including the casts and the 
narrowing. The migration guide has entries for this and for the subquery 
comparisons.
   - **Analysis phase.** `AQEOptimizer` also runs outside the analysis phase, 
like `Optimizer`, for queries that analyzer rules execute.
   - **Plan walks.** A set operation only walks its plan for recursive 
references when its CHAR lengths differ.
   
   Can you please re-review?


-- 
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