jayzhan211 commented on code in PR #11989:
URL: https://github.com/apache/datafusion/pull/11989#discussion_r1722942227
##########
datafusion/expr/src/udaf.rs:
##########
@@ -552,6 +570,14 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
fn is_descending(&self) -> Option<bool> {
None
}
+
+ /// Returns default value of the function given the input is all `null`.
+ ///
+ /// Most of the aggregate function return Null if input is Null,
+ /// while `count` returns 0 if input is Null
+ fn default_value(&self, data_type: &DataType) -> Result<ScalarValue> {
+ ScalarValue::try_from(data_type)
+ }
}
Review Comment:
In this case, it should at least failed when creating record batch. Since
the schema indicates non-null but got null value.
If you are saying prevent `panic`, it is a good question, I don't have answer
--
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]