Skip to content
Snippets Groups Projects
Commit 47efb644 authored by Maksim Kaitmazian's avatar Maksim Kaitmazian Committed by Maksim Kaitmazian
Browse files

fix: return the actual type for min/max functions instead of scalar

parent edad2751
No related branches found
No related tags found
1 merge request!1414sbroad import
......@@ -122,7 +122,24 @@ impl Expression {
Ok(Type::Array)
}
}
Expression::StableFunction { func_type, .. } => Ok(func_type.clone()),
Expression::StableFunction {
name,
func_type,
children,
..
} => {
// min/max functions have a scalar type, which means that their actual type can be
// inferred from the arguments.
if let "max" | "min" = name.as_str() {
let expr_id = children
.first()
.expect("min/max functions must have an argument");
let expr = plan.get_expression_node(*expr_id)?;
expr.calculate_type(plan)
} else {
Ok(func_type.clone())
}
}
Expression::CountAsterisk => Ok(Type::Integer),
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment