crepererum commented on code in PR #10038:
URL:
https://github.com/apache/arrow-datafusion/pull/10038#discussion_r1560648005
##########
datafusion/optimizer/src/analyzer/inline_table_scan.rs:
##########
@@ -51,65 +47,37 @@ impl AnalyzerRule for InlineTableScan {
}
fn analyze_internal(plan: LogicalPlan) -> Result<Transformed<LogicalPlan>> {
- match plan {
- // Match only on scans without filter / projection / fetch
- // Views and DataFrames won't have those added
- // during the early stage of planning
- LogicalPlan::TableScan(TableScan {
- table_name,
- source,
- projection,
- filters,
- ..
- }) if filters.is_empty() && source.get_logical_plan().is_some() => {
- let sub_plan = source.get_logical_plan().unwrap();
- let projection_exprs = generate_projection_expr(&projection,
sub_plan)?;
- LogicalPlanBuilder::from(sub_plan.clone())
- .project(projection_exprs)?
- // Ensures that the reference to the inlined table remains the
- // same, meaning we don't have to change any of the parent
nodes
- // that reference this table.
- .alias(table_name)?
- .build()
- .map(Transformed::yes)
- }
- LogicalPlan::Filter(filter) => {
- let new_expr =
filter.predicate.transform(&rewrite_subquery).data()?;
- Filter::try_new(new_expr, filter.input)
- .map(|e| Transformed::yes(LogicalPlan::Filter(e)))
+ // rewrite any subqueries in the plan first
+ let result = plan.map_subqueries(|plan|
plan.transform_up(&analyze_internal))?;
Review Comment:
```suggestion
let plan = plan.map_subqueries(|plan|
plan.transform_up(&analyze_internal))?;
```
When I read "result" I'm kinda expecting this to be a `Result<_, _>` which
-- based on the `result.transform_data` call below -- is not the case here.
Same comment applies to the `let result` a few lines below.
--
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]