Skip to content

Commit

Permalink
implement short_circuits function for ScalarUDFImpl trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordworms committed Apr 22, 2024
1 parent 70db5ea commit 7a4b342
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datafusion/expr/src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ pub trait ScalarUDFImpl: Debug + Send + Sync {
) -> Result<ExprSimplifyResult> {
Ok(ExprSimplifyResult::Original(args))
}
/// Returns true if some of this `exprs` subexpressions may not be evaluated
/// and thus any side effects (like divide by zero) may not be encountered
/// Setting this to true prevents certain optimizations such as common subexpression elimination
fn short_circuits(&self) -> bool {
false
}
}

/// ScalarUDF that adds an alias to the underlying function. It is better to
Expand Down

0 comments on commit 7a4b342

Please sign in to comment.