marvelshan opened a new pull request, #4615:
URL: https://github.com/apache/datafusion-comet/pull/4615

   ## Which issue does this PR close?
   
   Closes #4484
   
   ## Rationale for this change
   
   `try_mod` (Spark 4.0+) is `RuntimeReplaceable` and rewrites to 
`Remainder(left, right, EvalMode.TRY)`. Comet's `CometRemainder` serde 
explicitly rejected `EvalMode.TRY`, causing the enclosing plan to fall back to 
Spark. The sibling arithmetic serdes (`CometAdd`, `CometSubtract`, 
`CometMultiply`, `CometDivide`, `CometIntegralDivide`) all accept 
`EvalMode.TRY`, and the Rust `spark_modulo` UDF already takes a `fail_on_error: 
bool` flag that correctly returns NULL on divide-by-zero when 
`fail_on_error=false` (which is the TRY mode behavior).
   
   ## What changes are included in this PR?
   
   - Removed the `EvalMode.TRY` rejection block from `CometRemainder.convert` 
in `arithmetic.scala`, aligning it with the other arithmetic serdes
   - Added SQL file tests for `try_mod` in `arithmetic_try.sql` 
(MinSparkVersion: 4.0)
   - Updated `expressions.md` to mark `try_mod` as supported and remove the 
fallback note from `%`
   
   ## How are these changes tested?
   
   - Existing Rust tests for `spark_modulo` (4 tests covering basic modulo, 
decimal modulo, divide-by-zero, and complex expressions) continue to pass
   - New SQL file tests in `arithmetic_try.sql` cover `try_mod` with integer, 
long, divide-by-zero, NULL inputs, and column references
   
   ```bash
   ./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite arithmetic_try" 
-Dtest=none
   ```
   


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