MCPcopy Create free account
hub / github.com/apache/datafusion / f_down

Method f_down

datafusion/optimizer/src/decorrelate.rs:137–174  ·  view source on GitHub ↗
(&mut self, plan: LogicalPlan)

Source from the content-addressed store, hash-verified

135 type Node = LogicalPlan;
136
137 fn f_down(&mut self, plan: LogicalPlan) -> Result<Transformed<LogicalPlan>> {
138 match plan {
139 LogicalPlan::Filter(_) => Ok(Transformed::no(plan)),
140 // Subquery nodes are scope boundaries for correlation. A nested
141 // Subquery's outer references belong to a different decorrelation
142 // level and must not be pulled up into the current scope.
143 LogicalPlan::Subquery(_) => {
144 Ok(Transformed::new(plan, false, TreeNodeRecursion::Jump))
145 }
146 LogicalPlan::Union(_) | LogicalPlan::Sort(_) | LogicalPlan::Extension(_) => {
147 let plan_hold_outer = !plan.all_out_ref_exprs().is_empty();
148 if plan_hold_outer {
149 // the unsupported case
150 self.can_pull_up = false;
151 Ok(Transformed::new(plan, false, TreeNodeRecursion::Jump))
152 } else {
153 Ok(Transformed::no(plan))
154 }
155 }
156 LogicalPlan::Limit(_) => {
157 let plan_hold_outer = !plan.all_out_ref_exprs().is_empty();
158 match (self.exists_sub_query, plan_hold_outer) {
159 (false, true) => {
160 // the unsupported case
161 self.can_pull_up = false;
162 Ok(Transformed::new(plan, false, TreeNodeRecursion::Jump))
163 }
164 _ => Ok(Transformed::no(plan)),
165 }
166 }
167 _ if plan.contains_outer_reference() => {
168 // the unsupported cases, the plan expressions contain out reference columns(like window expressions)
169 self.can_pull_up = false;
170 Ok(Transformed::new(plan, false, TreeNodeRecursion::Jump))
171 }
172 _ => Ok(Transformed::no(plan)),
173 }
174 }
175
176 fn f_up(&mut self, plan: LogicalPlan) -> Result<Transformed<LogicalPlan>> {
177 let subquery_schema = plan.schema();

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
all_out_ref_exprsMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected