Apply a pipe operator to a plan
(
&self,
plan: LogicalPlan,
pipe_operator: PipeOperator,
planner_context: &mut PlannerContext,
)
| 117 | |
| 118 | /// Apply a pipe operator to a plan |
| 119 | fn pipe_operator( |
| 120 | &self, |
| 121 | plan: LogicalPlan, |
| 122 | pipe_operator: PipeOperator, |
| 123 | planner_context: &mut PlannerContext, |
| 124 | ) -> Result<LogicalPlan> { |
| 125 | match pipe_operator { |
| 126 | PipeOperator::Where { expr } => { |
| 127 | self.plan_selection(Some(expr), plan, planner_context) |
| 128 | } |
| 129 | PipeOperator::OrderBy { exprs } => { |
| 130 | let sort_exprs = self.order_by_to_sort_expr( |
| 131 | exprs, |
| 132 | plan.schema(), |
| 133 | planner_context, |
| 134 | true, |
| 135 | None, |
| 136 | )?; |
| 137 | self.order_by(plan, sort_exprs) |
| 138 | } |
| 139 | PipeOperator::Limit { expr, offset } => self.limit( |
| 140 | plan, |
| 141 | Some(LimitClause::LimitOffset { |
| 142 | limit: Some(expr), |
| 143 | offset: offset.map(|offset| Offset { |
| 144 | value: offset, |
| 145 | rows: OffsetRows::None, |
| 146 | }), |
| 147 | limit_by: vec![], |
| 148 | }), |
| 149 | planner_context, |
| 150 | ), |
| 151 | PipeOperator::Select { exprs } => { |
| 152 | let empty_from = matches!(plan, LogicalPlan::EmptyRelation(_)); |
| 153 | let select_exprs = |
| 154 | self.prepare_select_exprs(&plan, exprs, empty_from, planner_context)?; |
| 155 | self.project(plan, select_exprs, None) |
| 156 | } |
| 157 | PipeOperator::Extend { exprs } => { |
| 158 | let empty_from = matches!(plan, LogicalPlan::EmptyRelation(_)); |
| 159 | let extend_exprs = |
| 160 | self.prepare_select_exprs(&plan, exprs, empty_from, planner_context)?; |
| 161 | let all_exprs = |
| 162 | std::iter::once(SelectExpr::Wildcard(WildcardOptions::default())) |
| 163 | .chain(extend_exprs) |
| 164 | .collect(); |
| 165 | self.project(plan, all_exprs, None) |
| 166 | } |
| 167 | PipeOperator::As { alias } => self.apply_table_alias( |
| 168 | plan, |
| 169 | TableAlias { |
| 170 | name: alias, |
| 171 | // Apply to all fields |
| 172 | columns: vec![], |
| 173 | explicit: true, |
| 174 | at: None, |
| 175 | }, |
| 176 | ), |
no test coverage detected