File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
datafusion/core/src/datasource/physical_plan Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -452,10 +452,11 @@ fn get_projected_output_ordering(
452
452
) -> Vec < Vec < PhysicalSortExpr > > {
453
453
let mut all_orderings = vec ! [ ] ;
454
454
for output_ordering in & base_config. output_ordering {
455
- // Check if all file groups are sorted
456
- if base_config. file_groups . iter ( ) . all ( |group| {
455
+ // Check if any file groups are not sorted
456
+ if base_config. file_groups . iter ( ) . any ( |group| {
457
457
if group. len ( ) <= 1 {
458
- return true ;
458
+ // File groups with <= 1 files are always sorted
459
+ return false ;
459
460
}
460
461
461
462
let statistics = match MinMaxStatistics :: new_from_files (
@@ -471,7 +472,7 @@ fn get_projected_output_ordering(
471
472
}
472
473
} ;
473
474
474
- statistics. is_sorted ( )
475
+ ! statistics. is_sorted ( )
475
476
} ) {
476
477
debug ! (
477
478
"Skipping specified output ordering {:?}. \
You can’t perform that action at this time.
0 commit comments