You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compute ScalarFunction's return_field on creation #20290
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)]pubstructScalarFunction{/// The functionpubfunc:Arc<crate::ScalarUDF>,/// List of expressions to feed to the functions as argumentspubargs:Vec<Expr>,/// Return field of the functionreturn_field:FieldRef,}
Not sure if a new constructor ScalarFunction::new_udf_with_return_field should be created or change the original ScalarFunction::new_udf
Activity
Trikooo commentedon Feb 11, 2026
take
Jefffrey commentedon Feb 11, 2026
fyi
return_typeandnullableon creation #13825Trikooo commentedon Feb 12, 2026
Right, I didn't thoroughly read that they suggested the return Field.
return_typeandnullableon creation #13825