Skip to content

Commit 9228473

Browse files
authored
fix: remove trivial column in block operator (#10940)
1 parent eb96f89 commit 9228473

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/query/service/src/pipelines/pipeline_builder.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use common_expression::DataBlock;
2525
use common_expression::DataSchemaRef;
2626
use common_expression::FunctionContext;
2727
use common_expression::HashMethodKind;
28+
use common_expression::RemoteExpr;
2829
use common_expression::SortColumnDescription;
2930
use common_functions::aggregates::AggregateFunctionFactory;
3031
use common_functions::aggregates::AggregateFunctionRef;
@@ -382,6 +383,12 @@ impl PipelineBuilder {
382383
let exprs = eval_scalar
383384
.exprs
384385
.iter()
386+
.filter(|(scalar, idx)| {
387+
if let RemoteExpr::ColumnRef { id, .. } = scalar {
388+
return idx != id;
389+
}
390+
true
391+
})
385392
.map(|(scalar, _)| scalar.as_expr(&BUILTIN_FUNCTIONS))
386393
.collect::<Vec<_>>();
387394

src/query/sql/src/executor/physical_plan.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ impl EvalScalar {
133133
let input_schema = self.input.output_schema()?;
134134
let mut fields = input_schema.fields().clone();
135135
for (expr, index) in self.exprs.iter() {
136+
if let RemoteExpr::ColumnRef { id, .. } = expr {
137+
if index == id {
138+
continue;
139+
}
140+
}
136141
let name = index.to_string();
137142
let data_type = expr.as_expr(&BUILTIN_FUNCTIONS).data_type().clone();
138143
fields.push(DataField::new(&name, data_type));

0 commit comments

Comments
 (0)