Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions datafusion/expr/src/expr_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,9 @@ impl ExprSchemable for Expr {
let (_, nullable) = self.data_type_and_nullable(input_schema)?;
Ok(nullable)
}
Expr::AggregateFunction(AggregateFunction { func, .. }) => {
Ok(func.is_nullable())
Expr::AggregateFunction(_) => {
let (_, nullable) = self.data_type_and_nullable(input_schema)?;
Ok(nullable)
}
Expr::WindowFunction(window_function) => self
.data_type_and_nullable_with_window_function(
Expand Down
11 changes: 10 additions & 1 deletion datafusion/expr/src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ impl AggregateUDF {
}

pub fn is_nullable(&self) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method be deprecated too ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep thanks!

#[allow(deprecated)]
self.inner.is_nullable()
}

Expand Down Expand Up @@ -532,6 +533,10 @@ pub trait AggregateUDFImpl: Debug + DynEq + DynHash + Send + Sync {
/// For example, aggregate functions like `COUNT` always return a non null value
/// but others like `MIN` will return `NULL` if there is nullable input.
/// Note that if the function is declared as *not* nullable, make sure the [`AggregateUDFImpl::default_value`] is `non-null`
#[deprecated(
since = "51.0.0",
note = "Use `return_field` instead with return_field.is_nullable()."
)]
fn is_nullable(&self) -> bool {
true
}
Expand Down Expand Up @@ -1100,7 +1105,10 @@ pub fn udaf_default_return_field<F: AggregateUDFImpl + ?Sized>(
Ok(Arc::new(Field::new(
func.name(),
data_type,
func.is_nullable(),
#[allow(deprecated)]
{
func.is_nullable()
},
)))
}

Expand Down Expand Up @@ -1247,6 +1255,7 @@ impl AggregateUDFImpl for AliasedAggregateUDFImpl {
}

fn is_nullable(&self) -> bool {
#[allow(deprecated)]
self.inner.is_nullable()
}

Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl AggregateExprBuilder {
)?;

let return_field = fun.return_field(&input_exprs_fields)?;
let is_nullable = fun.is_nullable();
let is_nullable = return_field.is_nullable();
let name = match alias {
None => {
return internal_err!(
Expand Down