Function mz_sql::plan::query::coerce_homogeneous_exprs
source · pub fn coerce_homogeneous_exprs(
ecx: &ExprContext<'_>,
exprs: Vec<CoercibleScalarExpr>,
force_type: Option<&ScalarType>,
) -> Result<Vec<HirScalarExpr>, PlanError>
Expand description
Coerces a list of expressions such that all input expressions will be cast to the same type. If successful, returns a new list of expressions in the same order as the input, where each expression has the appropriate casts to make them all of a uniform type.
If force_type
is Some
, the expressions are forced to the specified type
via an explicit cast. Otherwise the best common type is guessed via
typeconv::guess_best_common_type
and conversions are attempted via
implicit casts
Note that this is our implementation of Postgres’ type conversion for
“UNION
, CASE
, and Related Constructs”, though it
isn’t yet used in all of those cases.