adriangb commented on code in PR #21182:
URL: https://github.com/apache/datafusion/pull/21182#discussion_r3012556651
##########
datafusion/datasource/src/file_scan_config.rs:
##########
@@ -896,28 +896,90 @@ impl DataSource for FileScanConfig {
}
}
+ /// Push sort requirements into file-based data sources.
+ ///
+ /// # Sort Pushdown Architecture
+ ///
+ /// ```text
+ /// Query: SELECT ... ORDER BY col ASC [LIMIT N]
+ ///
+ /// PushdownSort optimizer
+ /// │
+ /// ▼
+ /// FileScanConfig::try_pushdown_sort()
+ /// │
+ /// ├─► FileSource::try_pushdown_sort()
+ /// │ │
+ /// │ ├─ natural ordering matches? ──► Exact
+ /// │ │ (e.g. Parquet WITH ORDER) │
+ /// │ │ ▼
+ /// │ │ rebuild_with_source(exact=true)
+ /// │ │ ├─ sort files by stats within
groups
+ /// │ │ ├─ verify non-overlapping
+ /// │ │ └─► keep output_ordering →
SortExec removed
+ /// │ │
+ /// │ ├─ reversed ordering matches? ──► Inexact
+ /// │ │ (reverse_row_groups=true) │
+ /// │ │ ▼
Review Comment:
This looked off in the diff
<img width="1660" height="760" alt="image"
src="https://github.com/user-attachments/assets/19cfcf46-1266-44c7-b407-3e61eb035770"
/>
--
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]