alamb commented on code in PR #3472:
URL: https://github.com/apache/arrow-datafusion/pull/3472#discussion_r971190302
##########
datafusion/core/src/physical_plan/planner.rs:
##########
@@ -1712,12 +1714,12 @@ mod tests {
.limit(3, Some(10))?
.build()?;
- let plan = plan(&logical_plan).await?;
+ let exec_plan = plan(&logical_plan).await?;
// verify that the plan correctly casts u8 to i64
// the cast here is implicit so has CastOptions with safe=true
- let expected = "BinaryExpr { left: Column { name: \"c7\", index: 6 },
op: Lt, right: TryCastExpr { expr: Literal { value: UInt8(5) }, cast_type:
Int64 } }";
- assert!(format!("{:?}", plan).contains(expected));
+ let expected = "BinaryExpr { left: Column { name: \"c7\", index: 2 },
op: Lt, right: Literal { value: Int64(5) } }";
Review Comment:
these plans are looking very nice now 👌 Nice work @liukun4515
##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -164,11 +163,61 @@ impl ExprRewriter for TypeCoercionRewriter<'_> {
};
expr.rewrite(&mut self.const_evaluator)
}
+ Expr::InList {
+ expr,
+ list,
+ negated,
+ } => {
+ let expr_data_type = expr.get_type(&self.schema)?;
+ let list_data_types = list
+ .iter()
+ .map(|list_expr| list_expr.get_type(&self.schema))
+ .collect::<Result<Vec<_>>>()?;
+ let result_type =
Review Comment:
I am not sure what you are asking @liukun4515
In general I think trying to centralize the coercion rules into the same
place will make the code easier to reason about and make the coercion logic
easier to find
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]