`FileScanConfig::output_ordering` must be vector of optionals
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Describe the bug
Currently the output ordering -- which is defined per partition -- is a vector of `LexOrdering`:
https://github.com/apache/datafusion/blob/d19bf524e384bc24e509c70f1806b6f330829529/datafusion/datasource/src/file_scan_config.rs#L183-L184
This was kinda OK before #16217 because `LexOrdering` was allowed to be empty -- which was basically a sentinel value for "not ordering". Now however the code cannot specify that a partition isn't ordered anymore. This actually leads to some funky bugs like in this code here:
https://github.com/apache/datafusion/blob/d19bf524e384bc24e509c70f1806b6f330829529/datafusion/datasource/src/file_scan_config.rs#L1382-L1384
So if the projection for a single partition leads to "unordered", then `get_projected_output_ordering(input).len() < input.len()`, i.e. we loose partitions. This can clearly not be right.
### To Reproduce
_No response_
### Expected behavior
`FileScanConfig::output_ordering` must be `Vec>`.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.