geoffreyclaude commented on code in PR #19270:
URL: https://github.com/apache/datafusion/pull/19270#discussion_r2608296993
##########
datafusion/spark/src/function/math/modulus.rs:
##########
@@ -83,15 +83,13 @@ impl ScalarUDFImpl for SparkMod {
}
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
- assert_eq_or_internal_err!(
- arg_types.len(),
- 2,
- "mod expects exactly two arguments"
- );
+ internal_err("return_field_from_args should be used instead")
+ }
- // Return the same type as the first argument for simplicity
- // Arrow's rem function handles type promotion internally
- Ok(arg_types[0].clone())
+ fn return_field_from_args(&self, args: ReturnFieldArgs) ->
Result<FieldRef> {
+ let any_nullable = args.input_fields.iter().any(|f| f.is_nullable());
Review Comment:
Maybe add a comment that `a mod 0` errors rather than returns NULL, to
explain why this check is sufficient?
--
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]