Skip to content

Commit 43f182f

Browse files
authored
[Minor], Bug Fix: Add empty ordering check at the source. (#7230)
* Bug fix: Add empty ordering check during projection at the source. * Minor changes
1 parent 01352a0 commit 43f182f

File tree

2 files changed

+16
-1
lines changed
  • datafusion/core

2 files changed

+16
-1
lines changed

datafusion/core/src/datasource/physical_plan/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,11 @@ fn get_projected_output_ordering(
959959
// since rest of the orderings are violated
960960
break;
961961
}
962-
all_orderings.push(new_ordering);
962+
// do not push empty entries
963+
// otherwise we may have `Some(vec![])` at the output ordering.
964+
if !new_ordering.is_empty() {
965+
all_orderings.push(new_ordering);
966+
}
963967
}
964968
all_orderings
965969
}

datafusion/core/tests/sqllogictests/test_files/groupby.slt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,3 +3459,14 @@ AggregateExec: mode=Final, gby=[], aggr=[FIRST_VALUE(foo.x)]
34593459
--CoalescePartitionsExec
34603460
----AggregateExec: mode=Partial, gby=[], aggr=[FIRST_VALUE(foo.x)]
34613461
------MemoryExec: partitions=8, partition_sizes=[1, 0, 0, 0, 0, 0, 0, 0]
3462+
3463+
3464+
query TT
3465+
EXPLAIN SELECT c
3466+
FROM multiple_ordered_table
3467+
ORDER BY c ASC;
3468+
----
3469+
logical_plan
3470+
Sort: multiple_ordered_table.c ASC NULLS LAST
3471+
--TableScan: multiple_ordered_table projection=[c]
3472+
physical_plan CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/data/window_2.csv]]}, projection=[c], output_ordering=[c@0 ASC NULLS LAST], has_header=true

0 commit comments

Comments
 (0)