JSOD11 commented on PR #19270:
URL: https://github.com/apache/datafusion/pull/19270#issuecomment-3690611116

   Thanks @Jefffrey, I took another look and I believe they are both nullable.
   
   `Mod` is not immediately listed anywhere among those other functions. 
Instead, we have [trait 
DivModLike](https://github.com/apache/spark/blob/316322cbcb55ff5c1b4e479bc2aae12babdae534/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala#L651)
 which is a common base trait for `Divide` and `Remainder`, since the two 
classes are so similar. This `trait` [is 
nullable](https://github.com/apache/spark/blob/316322cbcb55ff5c1b4e479bc2aae12babdae534/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala#L658).
   
   The [Remainder 
class](https://github.com/apache/spark/blob/316322cbcb55ff5c1b4e479bc2aae12babdae534/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala#L958)
 extends `DivModLike` and thus inherits the nullability. `Remainder` is 
registered as `"mod"` in the Spark function registry 
[here](https://github.com/apache/spark/blob/316322cbcb55ff5c1b4e479bc2aae12babdae534/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L425)
 and 
[here](https://github.com/apache/spark/blob/316322cbcb55ff5c1b4e479bc2aae12babdae534/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L455).
   
   This leads me to believe the modulo function is always nullable in Spark.
   
   `Pmod`, as you mentioned, is listed as nullable 
[here](https://github.com/apache/spark/blob/316322cbcb55ff5c1b4e479bc2aae12babdae534/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala#L1061).
   
   I've updated the PR to reflect this.


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