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
Current coerce_type mixed with too many functions.
I want to split check type conversion from coerce_type.
such as code
type_coercion.rs:566// Support the `IsTrue` `IsNotTrue` `IsFalse` `IsNotFalse` type coercion.// The above op will be rewrite to the binary op when creating the physical op.fnget_casted_expr_for_bool_op(expr:&Expr,schema:&DFSchemaRef) -> Result<Expr>{let left_type = expr.get_type(schema)?;let right_type = DataType::Boolean;let coerced_type = coerce_types(&left_type,&Operator::IsDistinctFrom,&right_type)?;
expr.clone().cast_to(&coerced_type, schema)}
In above code, coerce_types() is just for checking TypeConversion, because we already know coerced_type is Boolean.
I think we can check TypeConversion in expr.cast_to().
Splitting the "what is the result type of this expression" calculation from "what types should the inputs be coerced to to execute it" is a great idea in my opinion.
I also think it would make the code much easier to reason about if the input arguments were coerced once (during type coercion in the analysis phase) and then never again. Right now I can never quite tell if the inputs to an expr have been coerced or not
Describe the bug
Current
coerce_type
mixed with too many functions.I want to split
check type conversion
fromcoerce_type
.such as code
In above code,
coerce_types()
is just for checking TypeConversion, because we already knowcoerced_type
isBoolean
.I think we can check
TypeConversion
inexpr.cast_to()
.Here is SQLServer Data type conversion Doc.
https://learn.microsoft.com/en-us/sql/t-sql/data-types/data-type-conversion-database-engine?view=sql-server-2017
To Reproduce
No response
Expected behavior
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: