Skip to content

Commit

Permalink
add error check
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Sep 18, 2019
1 parent 07c31d8 commit 56edbc5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rust/datafusion/src/execution/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,17 @@ impl ExecutionContext {
common::collect(it)
}
_ => {
// merge into a single partition
let plan = MergeExec::new(plan.schema().clone(), partitions);
let partitions = plan.partitions()?;
let it = partitions[0].execute()?;
common::collect(it)
if partitions.len() == 1 {
common::collect(partitions[0].execute()?)
} else {
Err(ExecutionError::InternalError(format!(
"MergeExec returned {} partitions",
partitions.len()
)))
}
}
}
}
Expand Down

0 comments on commit 56edbc5

Please sign in to comment.