alamb commented on PR #14821: URL: https://github.com/apache/datafusion/pull/14821#issuecomment-2686328283
``` "SortExec: expr=[non_nullable_col@1 ASC NULLS LAST, count@2 ASC NULLS LAST], preserve_partitioning=[false]", " WindowAggExec: wdw=[count: Ok(Field { name: \"count\", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }), frame: WindowFrame { units: Rows, start_bound: Preceding(UInt64(NULL)), end_bound: Following(UInt64(NULL)), is_causal: false }]", " DataSourceExec: file_groups={1 group: [[x]]}, projection=[nullable_col, non_nullable_col], output_ordering=[nullable_col@0 ASC NULLS LAST], file_type=parquet", ``` > > The reason this doesn't happen on main is because they (1) [immediately see if they can push down](https://github.com/apache/datafusion/blob/f5b7affecd90e9be26289d869c4a542359cb98e3/datafusion/physical-optimizer/src/enforce_sorting/sort_pushdown.rs#L125) the sort to it's child (without the recursive call to walk down to the child), and then (2) if it cannot be pushed down then re-use the same SortExec node ([this branch here](https://github.com/apache/datafusion/blob/f5b7affecd90e9be26289d869c4a542359cb98e3/datafusion/physical-optimizer/src/enforce_sorting/sort_pushdown.rs#L145-L148)), rather than reconstructing from the equivalence properties' ordering (which has constants removed). What are the output sort properties of `WindowAggExec`? It seems like it should report that it is compatible with the `SortExec` `WindowAggExec` would produce a sort output that is `nullable_col` and `constants={count}` So then I would expect that the sort properties should be satisfied and this pass should eliminate the SortExec 🤔 -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org