(
&self,
mut from: Vec<TableWithJoins>,
planner_context: &mut PlannerContext,
)
| 748 | } |
| 749 | |
| 750 | pub(crate) fn plan_from_tables( |
| 751 | &self, |
| 752 | mut from: Vec<TableWithJoins>, |
| 753 | planner_context: &mut PlannerContext, |
| 754 | ) -> Result<LogicalPlan> { |
| 755 | match from.len() { |
| 756 | 0 => Ok(LogicalPlanBuilder::empty(true).build()?), |
| 757 | 1 => { |
| 758 | let input = from.remove(0); |
| 759 | self.plan_table_with_joins(input, planner_context) |
| 760 | } |
| 761 | _ => { |
| 762 | let mut from = from.into_iter(); |
| 763 | |
| 764 | let mut left = LogicalPlanBuilder::from({ |
| 765 | let input = from.next().unwrap(); |
| 766 | self.plan_table_with_joins(input, planner_context)? |
| 767 | }); |
| 768 | let old_outer_from_schema = { |
| 769 | let left_schema = Some(Arc::clone(left.schema())); |
| 770 | planner_context.set_outer_from_schema(left_schema) |
| 771 | }; |
| 772 | for input in from { |
| 773 | // Join `input` with the current result (`left`). |
| 774 | let right = self.plan_table_with_joins(input, planner_context)?; |
| 775 | left = left.cross_join(right)?; |
| 776 | // Update the outer FROM schema. |
| 777 | let left_schema = Some(Arc::clone(left.schema())); |
| 778 | planner_context.set_outer_from_schema(left_schema); |
| 779 | } |
| 780 | planner_context.set_outer_from_schema(old_outer_from_schema); |
| 781 | left.build() |
| 782 | } |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | /// Returns the `Expr`'s corresponding to a SQL query's SELECT expressions. |
| 787 | pub(crate) fn prepare_select_exprs( |
no test coverage detected