mustafasrepo opened a new issue, #4438: URL: https://github.com/apache/arrow-datafusion/issues/4438
**Describe the bug** `output_ordering` method of `WindowAggExec` gives output ordering of its input, as in the [link](https://github.com/apache/arrow-datafusion/blob/fdc83e8524df30ac5d0ae097572b7c48dc686ba9/datafusion/core/src/physical_plan/windows/window_agg_exec.rs#L125). Although conceptually it is the correct behavior, `SortExec` is added before the `WindowAggExec` during `BasicEnforcement` pass of the `PhysicalOptimizerRule` (relevant [section](https://github.com/apache/arrow-datafusion/blob/fdc83e8524df30ac5d0ae097572b7c48dc686ba9/datafusion/core/src/physical_optimizer/enforcement.rs#L98)). Hence if we inquire the `output_ordering` of the `WindowAggExec` before `SortExec` is added, we will get wrong orderings. **To Reproduce** N.A **Expected behavior** I expect to get true output ordering for `WindowAggExec` during physical plan construction (before optimizations are applied) **Additional context** N.A -- 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...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org