zhuqi-lucas commented on code in PR #22493:
URL: https://github.com/apache/datafusion/pull/22493#discussion_r3294827786
##########
datafusion/datasource/src/file_scan_config/mod.rs:
##########
@@ -973,9 +978,44 @@ impl DataSource for FileScanConfig {
}
}
SortOrderPushdownResult::Inexact { inner } => {
- Ok(SortOrderPushdownResult::Inexact {
- inner: Arc::new(self.rebuild_with_source(inner, false,
order)?),
- })
+ let mut config = self.rebuild_with_source(inner, false,
order)?;
+ // `rebuild_with_source` reorders files by stats; if the
+ // post-sort files are non-overlapping AND the request now
+ // validates against the new file groups, `output_ordering`
+ // is preserved and we can upgrade back to Exact. This
+ // restores the sort-elimination behaviour that lived in
+ // the `Unsupported` → `try_sort_file_groups_by_statistics`
+ // path before #21956 routed `column_in_file_schema` cases
+ // here.
+ if config.output_ordering.is_empty() {
+ Ok(SortOrderPushdownResult::Inexact {
+ inner: Arc::new(config),
+ })
+ } else {
Review Comment:
Good point @adriangb , addressed in latest PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]