andygrove opened a new issue, #4484: URL: https://github.com/apache/datafusion-comet/issues/4484
## Describe the bug `try_mod` (Spark 4.0+) is `RuntimeReplaceable` and rewrites to `Remainder(left, right, EvalMode.TRY)`. Comet's `CometRemainder` serde explicitly rejects `EvalMode.TRY` with `withInfo(expr, "Eval mode TRY is not supported")` and returns `None`, so the enclosing plan falls back to Spark. The sibling arithmetic serdes (`CometAdd`, `CometSubtract`, `CometMultiply`, `CometDivide`, `CometIntegralDivide`) all accept `EvalMode.TRY` by propagating the mode through `evalModeToProto`, and the Rust `spark_modulo` UDF already takes a `fail_on_error: bool` flag, so there is no semantic obstacle to letting `EvalMode.TRY` through. Surfaced by the math-expressions audit (collection PR queue). ## Steps to reproduce ```sql SELECT try_mod(10, 0); -- Spark 4.0+ returns NULL; Comet falls back ``` ## Expected behavior `CometRemainder` should accept `EvalMode.TRY` the same way the other arithmetic serdes do (TRY currently behaves identically to LEGACY at the Rust layer, returning NULL on divide-by-zero). ## Additional context - Comet serde: `CometRemainder` in `spark/src/main/scala/org/apache/comet/serde/arithmetic.scala` - Rust impl: `native/spark-expr/src/math_funcs/modulo_expr.rs::spark_modulo` - Spark reference: `TryMod` in `org.apache.spark.sql.catalyst.expressions.tryArithmetic.scala` -- 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]
