Skip to content

Commit 9d2d031

Browse files
committed
Do not build mapping if parent does not require any
This patch adds a small optimization that can soft the edges on some queries. If there are no parent requirements we do not need to build column mapping.
1 parent 4dd59e2 commit 9d2d031

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • datafusion/physical-expr/src/utils

datafusion/physical-expr/src/utils/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ pub fn map_columns_before_projection(
8686
parent_required: &[Arc<dyn PhysicalExpr>],
8787
proj_exprs: &[(Arc<dyn PhysicalExpr>, String)],
8888
) -> Vec<Arc<dyn PhysicalExpr>> {
89+
if parent_required.is_empty() {
90+
// No need to build mapping.
91+
return vec![];
92+
}
8993
let column_mapping = proj_exprs
9094
.iter()
9195
.filter_map(|(expr, name)| {

0 commit comments

Comments
 (0)