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

Method plan_from_tables

datafusion/sql/src/select.rs:750–784  ·  view source on GitHub ↗
(
        &self,
        mut from: Vec<TableWithJoins>,
        planner_context: &mut PlannerContext,
    )

Source from the content-addressed store, hash-verified

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(

Callers 2

select_to_planMethod · 0.80
update_to_planMethod · 0.80

Calls 10

plan_table_with_joinsMethod · 0.80
set_outer_from_schemaMethod · 0.80
cross_joinMethod · 0.80
emptyFunction · 0.50
lenMethod · 0.45
buildMethod · 0.45
removeMethod · 0.45
into_iterMethod · 0.45
nextMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected