Skip to content

Commit 22080b4

Browse files
author
Egor Markov
committed
serde: fix FilterExec with empty projection
Prior this patch FilterExec with empty projection was deserialized as FilterExec with *-projection
1 parent 302102f commit 22080b4

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

  • datafusion/proto/src/physical_plan

datafusion/proto/src/physical_plan/mod.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -684,17 +684,13 @@ impl protobuf::PhysicalPlanNode {
684684
})?;
685685

686686
let filter_selectivity = filter.default_filter_selectivity.try_into();
687-
let projection = if !filter.projection.is_empty() {
688-
Some(
689-
filter
690-
.projection
691-
.iter()
692-
.map(|i| *i as usize)
693-
.collect::<Vec<_>>(),
694-
)
695-
} else {
696-
None
697-
};
687+
let projection = Some(
688+
filter
689+
.projection
690+
.iter()
691+
.map(|i| *i as usize)
692+
.collect::<Vec<_>>(),
693+
);
698694

699695
let filter = FilterExecBuilder::new(predicate, input)
700696
.apply_projection(projection)?
@@ -2364,9 +2360,10 @@ impl protobuf::PhysicalPlanNode {
23642360
.physical_expr_to_proto(exec.predicate(), codec)?,
23652361
),
23662362
default_filter_selectivity: exec.default_selectivity() as u32,
2367-
projection: exec.projection().as_ref().map_or_else(Vec::new, |v| {
2368-
v.iter().map(|x| *x as u32).collect::<Vec<u32>>()
2369-
}),
2363+
projection: exec.projection().as_ref().map_or(
2364+
(0..exec.schema().fields().len() as u32).collect::<Vec<u32>>(),
2365+
|v| v.iter().map(|x| *x as u32).collect::<Vec<u32>>(),
2366+
),
23702367
batch_size: exec.batch_size() as u32,
23712368
fetch: exec.fetch().map(|f| f as u32),
23722369
},

0 commit comments

Comments
 (0)