jackwener commented on code in PR #5593:
URL: https://github.com/apache/arrow-datafusion/pull/5593#discussion_r1140365145
##########
datafusion/optimizer/src/decorrelate_where_in.rs:
##########
@@ -149,6 +152,7 @@ fn optimize_where_in(
let projection = Projection::try_from_plan(&query_info.query.subquery)
.map_err(|e| context!("a projection is required", e))?;
let subquery_input = projection.input.clone();
+ // TODO add the validate logic to Analyzer
Review Comment:
😍Look forward it!
##########
datafusion/core/tests/sql/subqueries.rs:
##########
@@ -179,3 +179,117 @@ async fn in_subquery_with_same_table() -> Result<()> {
Ok(())
}
+
+#[tokio::test]
+async fn support_agg_correlated_columns() -> Result<()> {
Review Comment:
If test just relate with `plan tree`, I think it's also ok to keep it here.
Because we can debug it easily, and see plan directly in the code.
##########
datafusion/sql/src/select.rs:
##########
@@ -234,28 +228,26 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
&self,
selection: Option<SQLExpr>,
plan: LogicalPlan,
- outer_query_schema: Option<&DFSchema>,
planner_context: &mut PlannerContext,
) -> Result<LogicalPlan> {
match selection {
Some(predicate_expr) => {
- let mut join_schema = (**plan.schema()).clone();
-
let fallback_schemas = plan.fallback_normalize_schemas();
- let outer_query_schema = if let Some(outer) =
outer_query_schema {
- join_schema.merge(outer);
- vec![outer]
- } else {
- vec![]
- };
+ let outer_query_schema =
planner_context.outer_query_schema.clone();
Review Comment:
Agree with it.
We can avoid a clone
--
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]