Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eejbyfeldt committed Sep 25, 2024
1 parent 5515063 commit e0e1d06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions datafusion/sql/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ impl PlannerContext {

/// extends the FROM schema, returning the existing one, if any
pub fn extend_outer_from_schema(&mut self, schema: &DFSchemaRef) -> Result<()> {
self.outer_from_schema = match self.outer_from_schema.as_ref() {
Some(from_schema) => Some(Arc::new(from_schema.join(schema)?)),
None => Some(Arc::clone(schema)),
match self.outer_from_schema.as_mut() {
Some(from_schema) => Arc::make_mut(from_schema).merge(schema),
None => self.outer_from_schema = Some(Arc::clone(schema)),
};
Ok(())
}
Expand Down
5 changes: 3 additions & 2 deletions datafusion/sql/src/relation/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::planner::{ContextProvider, PlannerContext, SqlToRel};
use datafusion_common::{not_impl_err, Column, Result};
use datafusion_expr::{JoinType, LogicalPlan, LogicalPlanBuilder};
use sqlparser::ast::{Join, JoinConstraint, JoinOperator, TableFactor, TableWithJoins};
use std::{collections::HashSet, sync::Arc};
use std::collections::HashSet;

impl<'a, S: ContextProvider> SqlToRel<'a, S> {
pub(crate) fn plan_table_with_joins(
Expand All @@ -34,7 +34,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
};
let old_outer_from_schema = planner_context.outer_from_schema();
for join in t.joins {
planner_context.set_outer_from_schema(Some(Arc::clone(left.schema())));
planner_context.set_outer_from_schema(old_outer_from_schema.clone());
planner_context.extend_outer_from_schema(left.schema())?;
left = self.parse_relation_join(left, join, planner_context)?;
}
planner_context.set_outer_from_schema(old_outer_from_schema);
Expand Down

0 comments on commit e0e1d06

Please sign in to comment.