-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
Related to #20012
Currently, the return field of ScalarFunctions is being computed three times during the query's lifecycle, during which the query's expression might change.
for example when a udf needs to implicitly cast a literal, it wraps that literal in a cast and recomputes the return field again after initial computation without the cast, leading to inconsistent results.
Describe the solution you'd like
Calculate the return_type during creation.
#[derive(Clone, PartialEq, Eq, PartialOrd, Hash, Debug)]
pub struct ScalarFunction {
/// The function
pub func: Arc<crate::ScalarUDF>,
/// List of expressions to feed to the functions as arguments
pub args: Vec<Expr>,
/// Return field of the function
return_field: FieldRef,
}Not sure if a new constructor ScalarFunction::new_udf_with_return_field should be created or change the original ScalarFunction::new_udf
Describe alternatives you've considered
No response
Additional context
#13825 proposed a similar approach.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request