chore(query): remove extra projection if not need
@@ -227,8 +227,9 @@ impl PipelineBuilder {
.map(|name| schema.index_of(name.as_str()))
.collect::<Result<Vec<usize>>>()?;
+ // if projection is sequential, no need to add projection
+ if projection != (0..schema.fields().len()).collect::<Vec<usize>>() {
let ops = vec![BlockOperator::Project { projection }];
-
let func_ctx = self.ctx.try_get_function_context()?;
self.main_pipeline.add_transform(|input, output| {
Ok(CompoundBlockOperator::create(
@@ -237,7 +238,9 @@ impl PipelineBuilder {
func_ctx,
ops.clone(),
))
- })
+ })?;
+ }
+ Ok(())
}
fn build_filter(&mut self, filter: &Filter) -> Result<()> {
