zhangxinyao88 opened a new pull request, #59815: URL: https://github.com/apache/spark/pull/59815
### What changes were proposed in this pull request? Promote CHAR/VARCHAR to unbounded STRING when non-ANSI type coercion widens them with non-string values under `spark.sql.charVarchar.standardSemantics.enabled`. Preserve collation and the behavior when this option is disabled. ### Why are the changes needed? The [Non-ANSI CI run](https://github.com/apache/spark/actions/runs/40150427913) fails two `BasicCharVarcharTestSuite` cases because mixed-type COALESCE retains a CHAR/VARCHAR length constraint. `zeroifnull` takes the same path through COALESCE. Other failures in that workflow require separate fixes. ### Does this PR introduce _any_ user-facing change? Yes, when ANSI mode is disabled and CHAR/VARCHAR standard semantics is enabled. For example, `SELECT coalesce(cast(null AS CHAR(1)), 123)` now returns the string `'123'` instead of failing with `EXCEED_LIMIT_LENGTH`. VARCHAR behaves the same way. ### How was this patch tested? - Verified that the new type-coercion regression test fails before the fix. - Complete `TypeCoercionSuite` and `AnsiTypeCoercionSuite`: all 122 tests passed. - Complete `BasicCharVarcharTestSuite`: all 51 tests passed with ANSI disabled, and all 51 passed with ANSI enabled. Coverage includes the two original CI failures and the new regression cases. - Relevant main/test Scalastyle checks and `git diff --check` passed. The full scheduled Non-ANSI workflow has not yet been run with this patch. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (GPT-6) JIRA: [SPARK-60534](https://issues.apache.org/jira/browse/SPARK-60534) -- 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]
