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(
452452) -> Vec < Vec < PhysicalSortExpr > > {
453453 let mut all_orderings = vec ! [ ] ;
454454 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| {
457457 if group. len ( ) <= 1 {
458- return true ;
458+ // File groups with <= 1 files are always sorted
459+ return false ;
459460 }
460461
461462 let statistics = match MinMaxStatistics :: new_from_files (
@@ -471,7 +472,7 @@ fn get_projected_output_ordering(
471472 }
472473 } ;
473474
474- statistics. is_sorted ( )
475+ ! statistics. is_sorted ( )
475476 } ) {
476477 debug ! (
477478 "Skipping specified output ordering {:?}. \
You can’t perform that action at this time.
0 commit comments