File tree Expand file tree Collapse file tree 2 files changed +3
-16
lines changed
optimizer/src/optimize_projections Expand file tree Collapse file tree 2 files changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -535,10 +535,8 @@ fn merge_consecutive_projections(proj: Projection) -> Result<Transformed<Project
535535 // For details, see: https://github.com/apache/datafusion/issues/8296
536536 if column_referral_map. into_iter ( ) . any ( |( col, usage) | {
537537 usage > 1
538- && !is_expr_trivial (
539- & prev_projection. expr
540- [ prev_projection. schema . index_of_column ( col) . unwrap ( ) ] ,
541- )
538+ && !prev_projection. expr [ prev_projection. schema . index_of_column ( col) . unwrap ( ) ]
539+ . is_trivial ( )
542540 } ) {
543541 // no change
544542 return Projection :: try_new_with_schema ( expr, input, schema) . map ( Transformed :: no) ;
@@ -591,11 +589,6 @@ fn merge_consecutive_projections(proj: Projection) -> Result<Transformed<Project
591589 }
592590}
593591
594- // Check whether `expr` is trivial; i.e. it doesn't imply any computation.
595- fn is_expr_trivial ( expr : & Expr ) -> bool {
596- expr. is_trivial ( )
597- }
598-
599592/// Rewrites a projection expression using the projection before it (i.e. its input)
600593/// This is a subroutine to the `merge_consecutive_projections` function.
601594///
Original file line number Diff line number Diff line change @@ -946,7 +946,7 @@ fn try_unifying_projections(
946946 // beneficial as caching mechanism for non-trivial computations.
947947 // See discussion in: https://github.com/apache/datafusion/issues/8296
948948 if column_ref_map. iter ( ) . any ( |( column, count) | {
949- * count > 1 && !is_expr_trivial ( & Arc :: clone ( & child. expr ( ) [ column. index ( ) ] . expr ) )
949+ * count > 1 && !& child. expr ( ) [ column. index ( ) ] . expr . is_trivial ( )
950950 } ) {
951951 return Ok ( None ) ;
952952 }
@@ -1056,12 +1056,6 @@ fn new_columns_for_join_on(
10561056 ( new_columns. len ( ) == hash_join_on. len ( ) ) . then_some ( new_columns)
10571057}
10581058
1059- /// Checks if the given expression is trivial.
1060- /// An expression is considered trivial if it is a `Column`, `Literal`, or field accessor.
1061- fn is_expr_trivial ( expr : & Arc < dyn PhysicalExpr > ) -> bool {
1062- expr. is_trivial ( )
1063- }
1064-
10651059#[ cfg( test) ]
10661060mod tests {
10671061 use super :: * ;
You can’t perform that action at this time.
0 commit comments