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

   ### What changes were proposed in this pull request?
   
   Add `ExpressionImplUtils.chr(long longVal)` and route `Chr`'s eval and 
codegen paths through it. `Chr.doGenCode` previously emitted a ~7-line inline 
if/else chain (negative -> empty string, `(v & 0xFF) == 0` -> NUL, otherwise 
the Latin-1 character); it now emits a single `ExpressionImplUtils.chr(...)` 
call, and the eval path calls the same helper.
   
   This is a plain (non-ANSI, non-try/catch) type-independent block, in line 
with the broadened goal of SPARK-56908 to move fixed generated-Java logic into 
static Java helpers.
   
   ### Why are the changes needed?
   
   Part of SPARK-56908 (umbrella). Collapsing the inline if/else chain to one 
call shrinks the generated Java for every stage that uses `chr`, helping with 
the JVM 64KB method / constant-pool limits, Janino compile time, and JIT work.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. The compiled behavior is identical; only the emitted Java source text 
changes.
   
   ### How was this patch tested?
   
   ```
   build/sbt "catalyst/testOnly *StringExpressionsSuite"
   ```
   
   59/59 pass, including `string for ascii` which covers `Chr` over negative, 
zero, wrap-around (256), high-bit (149) and null inputs (exercised both with 
and without whole-stage codegen).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)


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