Skip to content

Commit e0e1d06

Browse files
committed
Fix tests
1 parent 5515063 commit e0e1d06

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

datafusion/sql/src/planner.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ impl PlannerContext {
197197

198198
/// extends the FROM schema, returning the existing one, if any
199199
pub fn extend_outer_from_schema(&mut self, schema: &DFSchemaRef) -> Result<()> {
200-
self.outer_from_schema = match self.outer_from_schema.as_ref() {
201-
Some(from_schema) => Some(Arc::new(from_schema.join(schema)?)),
202-
None => Some(Arc::clone(schema)),
200+
match self.outer_from_schema.as_mut() {
201+
Some(from_schema) => Arc::make_mut(from_schema).merge(schema),
202+
None => self.outer_from_schema = Some(Arc::clone(schema)),
203203
};
204204
Ok(())
205205
}

datafusion/sql/src/relation/join.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::planner::{ContextProvider, PlannerContext, SqlToRel};
1919
use datafusion_common::{not_impl_err, Column, Result};
2020
use datafusion_expr::{JoinType, LogicalPlan, LogicalPlanBuilder};
2121
use sqlparser::ast::{Join, JoinConstraint, JoinOperator, TableFactor, TableWithJoins};
22-
use std::{collections::HashSet, sync::Arc};
22+
use std::collections::HashSet;
2323

2424
impl<'a, S: ContextProvider> SqlToRel<'a, S> {
2525
pub(crate) fn plan_table_with_joins(
@@ -34,7 +34,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
3434
};
3535
let old_outer_from_schema = planner_context.outer_from_schema();
3636
for join in t.joins {
37-
planner_context.set_outer_from_schema(Some(Arc::clone(left.schema())));
37+
planner_context.set_outer_from_schema(old_outer_from_schema.clone());
38+
planner_context.extend_outer_from_schema(left.schema())?;
3839
left = self.parse_relation_join(left, join, planner_context)?;
3940
}
4041
planner_context.set_outer_from_schema(old_outer_from_schema);

0 commit comments

Comments
 (0)