Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions datafusion/expr/src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,13 @@ pub trait AggregateUDFImpl: Debug + DynEq + DynHash + Send + Sync {
///
/// closure returns simplified [Expr] or an error.
///
/// # Notes
///
/// The returned expression must have the same schema as the original
/// expression, including both the data type and nullability. For example,
/// if the original expression is nullable, the returned expression must
/// also be nullable, otherwise it may lead to schema verification errors
/// later in query planning.
fn simplify(&self) -> Option<AggregateFunctionSimplification> {
None
}
Expand Down
8 changes: 8 additions & 0 deletions datafusion/expr/src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,14 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send + Sync {
/// [`ExprSimplifyResult`] indicating the result of the simplification NOTE
/// if the function cannot be simplified, the arguments *MUST* be returned
/// unmodified
///
/// # Notes
///
/// The returned expression must have the same schema as the original
/// expression, including both the data type and nullability. For example,
/// if the original expression is nullable, the returned expression must
/// also be nullable, otherwise it may lead to schema verification errors
/// later in query planning.
fn simplify(
&self,
args: Vec<Expr>,
Expand Down
7 changes: 7 additions & 0 deletions datafusion/expr/src/udwf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@ pub trait WindowUDFImpl: Debug + DynEq + DynHash + Send + Sync {
/// Or, a closure with two arguments:
/// * 'window_function': [crate::expr::WindowFunction] for which simplified has been invoked
/// * 'info': [crate::simplify::SimplifyInfo]
///
/// # Notes
/// The returned expression must have the same schema as the original
/// expression, including both the data type and nullability. For example,
/// if the original expression is nullable, the returned expression must
/// also be nullable, otherwise it may lead to schema verification errors
/// later in query planning.
fn simplify(&self) -> Option<WindowFunctionSimplification> {
None
}
Expand Down