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

   Backport-of: #59060
   
   Adds `spark.sql.experimental.optimizer.transpileNullStrictness` (`strict` by 
default, or `loose`). Under `strict` the existing behavior is preserved: 
ordering comparisons (`<`, `<=`, `>`, `>=`) on a NULL operand raise an error
   matching Python's `TypeError`. Under `loose` NULL propagates as NULL 
instead, allowing UDFs with unguarded ordering comparisons to be transpiled at 
the cost of minor NULL-semantic divergence the user has opted into.
   
   Co-authored by: jing.zhansnowflake.com
   
   Users whose data has no NULLs, or who accept Spark's NULL-propagation 
behavior, currently get no benefit from the transpiler for UDFs with unguarded 
ordering comparisons. This config gives them an opt-in escape hatch.
   
   Yes. New session config 
`spark.sql.experimental.optimizer.transpileNullStrictness` (default `strict`, 
no behavior change). Under `loose`, ordering-comparison UDFs that previously 
fell back now transpile; NULL inputs return NULL instead of raising.
   
   Added `test_udf_transpile_null_strictness_strict_default`, 
`test_udf_transpile_null_strictness_loose` (all four operators, NULL and 
non-NULL inputs), and 
`test_udf_transpile_null_strictness_loose_does_not_affect_eq` to 
`test_udf_transpile_unit.py`. All existing tests pass.
   
   Co-authored by: Claude Sonnet 4.6
   
   Closes #59060 from jzhan-2026/spark-55220-null-strictness.
   
   Authored-by: jzhan-2026 <[email protected]>
   Co-Authored-by: jing <[email protected]>
   Signed-off-by: Holden Karau <[email protected]>
   (cherry picked from commit 749704a442011cfd996910b3b6d8b46064f318c9)
   Signed-off-by: Holden Karau <[email protected]>


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