Skip to content

Commit

Permalink
remove hard-coded batch size, remove comment, remove panic
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Sep 10, 2019
1 parent 21e646f commit d8ff02f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions rust/datafusion/src/execution/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ impl ExecutionContext {
pub fn create_physical_plan(
&mut self,
logical_plan: &Arc<LogicalPlan>,
batch_size: usize,
) -> Result<Arc<dyn ExecutionPlan>> {
match logical_plan.as_ref() {
LogicalPlan::TableScan {
Expand All @@ -228,7 +229,7 @@ impl ExecutionContext {
..
} => match (*self.datasources).borrow().get(table_name) {
Some(provider) => {
let partitions = provider.scan(projection, 16 * 1024)?;
let partitions = provider.scan(projection, batch_size)?;
if partitions.is_empty() {
Err(ExecutionError::General(
"Table provider returned no partitions".to_string(),
Expand All @@ -241,12 +242,14 @@ impl ExecutionContext {
Ok(Arc::new(exec))
}
}
_ => panic!(),
_ => Err(ExecutionError::General(format!(
"No table named {}",
table_name
))),
},
LogicalPlan::Projection { input, expr, .. } => {
let input = self.create_physical_plan(input)?;
let input = self.create_physical_plan(input, batch_size)?;
let input_schema = input.as_ref().schema().clone();
//let me = self;
let runtime_expr = expr
.iter()
.map(|e| self.create_physical_expr(e, &input_schema))
Expand Down Expand Up @@ -545,7 +548,7 @@ mod tests {

let logical_plan = ctx.create_logical_plan("SELECT c1, c2 FROM test")?;

let physical_plan = ctx.create_physical_plan(&logical_plan)?;
let physical_plan = ctx.create_physical_plan(&logical_plan, 1024)?;

let results = ctx.collect(physical_plan.as_ref())?;

Expand Down

0 comments on commit d8ff02f

Please sign in to comment.