Skip to content

Commit

Permalink
Set across_partitions=true when both sides are constant
Browse files Browse the repository at this point in the history
  • Loading branch information
gokselk committed Dec 17, 2024
1 parent 8bc7fd2 commit 3051cd4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions datafusion/physical-expr/src/equivalence/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,11 @@ fn calculate_union_binary(
.map(|rhs_const| {
let mut const_expr = ConstExpr::new(Arc::clone(lhs_const.expr()));

// If both sides are constant across partitions, set across_partitions=true
if lhs_const.across_partitions() && rhs_const.across_partitions() {
const_expr = const_expr.with_across_partitions(true);
}

// If both sides have matching constant values, preserve the value and set across_partitions=true
if let (Some(lhs_val), Some(rhs_val)) =
(lhs_const.value(), rhs_const.value())
Expand Down

0 comments on commit 3051cd4

Please sign in to comment.