liukun4515 commented on code in PR #3636:
URL: https://github.com/apache/arrow-datafusion/pull/3636#discussion_r982963278
##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -119,6 +134,41 @@ impl ExprRewriter for TypeCoercionRewriter {
fn mutate(&mut self, expr: Expr) -> Result<Expr> {
match expr {
+ Expr::ScalarSubquery(Subquery { subquery }) => {
+ let mut optimizer_config = OptimizerConfig::new();
+ let new_plan =
+ optimize_internal(&self.schema, &subquery, &mut
optimizer_config)?;
+ Ok(Expr::ScalarSubquery(Subquery::new(new_plan)))
+ }
+ Expr::Exists { subquery, negated } => {
+ let mut optimizer_config = OptimizerConfig::new();
+ let new_plan = optimize_internal(
Review Comment:
I also want this, but there are some correlated subquery, like the comments.
I have added the comments about the usage of `external_schema` schema
// merge the outer schema for correlated subqueries
// like case:
// select t2.c2 from t1 where t1.c1 in (select t2.c1 from t2 where
t2.c2=t1.c3)
For the subquery `select t2.c1 from t2 where t2.c2= t1.c3`, if we don't know
the schema about the `t1`, we can get the `data type` for `t1.c3` and can't do
the type coercion for `t2.c2=t1.c3`.
This is way that I find, do you @andygrove @alamb have any thoughts about
this?
--
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]