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

   ### What changes were proposed in this pull request?
   
   `NaNvl.doGenCode` always wrapped each child in a null check: an outer `if 
(leftGen.isNull) { ev.isNull = true; } else { ... }`, and (in the NaN-fallback 
path) an inner `if (rightGen.isNull) { ev.isNull = true; } else { ev.value = 
rightGen.value; }`. For a non-nullable child the `isNull` is statically 
`false`, so the wrapper is dead.
   
   This drops the outer wrapper when `left` is non-nullable and the inner one 
when `right` is non-nullable, emitting just the value assignment. The NaN check 
and the lazy evaluation of the right child (evaluated only when `left` is 
non-null and NaN) are preserved. The body is refactored into a few small 
`Block` values to express the gating cleanly.
   
   Follows the SPARK-56908 non-nullable-children dead-branch pattern of 
`GenArrayData.genCodeToCreateArrayData` / `CreateNamedStruct`.
   
   ### Why are the changes needed?
   
   It removes a dead comparison/branch per non-nullable child, shrinking the 
generated method (~3 lines per non-nullable child, ~6 when both are 
non-nullable), which helps with the JVM 64KB method / constant-pool limits, 
Janino compile time, and JIT work. Part of SPARK-56908.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Existing `NullExpressionsSuite` "nanvl" and `ColumnExpressionSuite` "nanvl", 
plus added `checkEvaluation` cases with nullable `BoundReference` children that 
exercise the both-children-nullable codegen path (the existing 
non-nullable-literal cases now take the dead-branch-skipping paths instead). 
`checkEvaluation` runs the interpreted and codegen paths; behavior is unchanged.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude 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