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

   **Title**: [SPARK-56912][SQL] Refactor Cast to boolean codegen under ANSI 
mode
   **Base**: master (stacked on PR 1→2→3)
   **Head**: gengliangwang:SPARK-56912-cast-boolean
   
   ### What changes were proposed in this pull request?
   
   Extend `CastUtils.java` with `stringToBooleanExact(UTF8String, 
QueryContext)` and use it from `Cast.scala` for the ANSI `String -> Boolean` 
cast path (both eval and codegen). The non-ANSI path keeps the inline `if/else 
if/else evNull = true` form because it has no error to throw.
   
   ### Why are the changes needed?
   
   Part of SPARK-56908 (umbrella). The ANSI String->Boolean cast emits an 
8-line `if (isTrueString) … else if (isFalseString) … else throw` block in 
codegen. This PR collapses it to a one-line 
`CastUtils.stringToBooleanExact(...)` call.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   ```
   build/sbt "catalyst/testOnly *CastSuite *CastWithAnsiOnSuite *AnsiCastSuite 
*TryCastSuite"
   ```
   
   204/204 pass.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Cursor 1.x
   


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