datafusion
datafusion copied to clipboard
fix: spark modulus need to have custom nullability
Which issue does this PR close?
- Closes #19165.
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?
@JSOD11 Please add unit test for all your changes.
Can we do something like this
fn return_field_for_binary_op(
name: &str,
args: ReturnFieldArgs,
) -> Result<FieldRef> {
let any_nullable = args.arg_fields.iter().any(|f| f.is_nullable());
let data_type = args.arg_fields[0].data_type().clone();
Ok(Arc::new(Field::new(name, data_type, any_nullable)))
}
And use in both the return_field_from_args functions to improve maintainability.