File tree 3 files changed +6
-5
lines changed
physical-expr/src/equivalence 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -211,9 +211,10 @@ pub fn const_exprs_contains(
211
211
const_exprs : & [ ConstExpr ] ,
212
212
expr : & Arc < dyn PhysicalExpr > ,
213
213
) -> bool {
214
- const_exprs
215
- . iter ( )
216
- . any ( |const_expr| const_expr. expr . eq ( expr) )
214
+ const_exprs. iter ( ) . any ( |const_expr| {
215
+ const_expr. expr . eq ( expr)
216
+ && const_expr. across_partitions ( ) != AcrossPartitions :: Heterogeneous
217
+ } )
217
218
}
218
219
219
220
/// An `EquivalenceClass` is a set of [`Arc<dyn PhysicalExpr>`]s that are known
Original file line number Diff line number Diff line change @@ -438,7 +438,7 @@ impl EquivalenceProperties {
438
438
let filtered_exprs = LexOrdering :: new (
439
439
sort_exprs
440
440
. into_iter ( )
441
- . filter ( |expr| !self . is_expr_constant ( & expr. expr ) )
441
+ . filter ( |expr| !self . is_expr_constant_across_partitions ( & expr. expr ) )
442
442
. collect ( ) ,
443
443
) ;
444
444
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ pub fn add_sort_above<T: Clone + Default>(
45
45
!node
46
46
. plan
47
47
. equivalence_properties ( )
48
- . is_expr_constant ( & sort_expr. expr )
48
+ . is_expr_constant_across_partitions ( & sort_expr. expr )
49
49
} ) ;
50
50
let mut new_sort = SortExec :: new ( sort_expr, Arc :: clone ( & node. plan ) ) . with_fetch ( fetch) ;
51
51
if node. plan . output_partitioning ( ) . partition_count ( ) > 1 {
You can’t perform that action at this time.
0 commit comments