You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/23 18:34:15 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4293: Support `SubqueryAlias` in optimizer, physcial planner.

alamb commented on code in PR #4293:
URL: https://github.com/apache/arrow-datafusion/pull/4293#discussion_r1030771314


##########
datafusion/optimizer/src/projection_push_down.rs:
##########
@@ -441,32 +368,16 @@ fn optimize_plan(
             }))
         }
         LogicalPlan::SubqueryAlias(SubqueryAlias { input, alias, .. }) => {
-            match input.as_ref() {
-                LogicalPlan::TableScan(TableScan { table_name, .. }) => {
-                    let new_required_columns = new_required_columns
-                        .iter()
-                        .map(|c| match &c.relation {
-                            Some(q) if q == alias => Column {
-                                relation: Some(table_name.clone()),
-                                name: c.name.clone(),
-                            },
-                            _ => c.clone(),
-                        })
-                        .collect();
-                    let new_inputs = vec![optimize_plan(
-                        _optimizer,
-                        input,
-                        &new_required_columns,
-                        has_projection,
-                        _optimizer_config,
-                    )?];
-                    let expr = vec![];
-                    from_plan(plan, &expr, &new_inputs)
-                }
-                _ => Err(DataFusionError::Plan(
-                    "SubqueryAlias should only wrap TableScan".to_string(),
-                )),
-            }
+            let new_required_columns =

Review Comment:
   this is a nice cleanup 👍 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org