itang06 opened a new pull request, #27522:
URL: https://github.com/apache/datafusion/pull/27522

   ## Which issue does this PR close?
   
   Closes #27267. This follows [Jay's 
proposal](https://github.com/apache/datafusion/issues/27267#issuecomment-6874775656).
 The broader #27439 also covers this issue. I'm opening this focused draft so 
maintainers can compare the two approaches.
   
   ## Rationale for this change
   
   The optimizer can drop a required sort when growing or shrinking aggregate 
window frames advertise the wrong NULL placement.
   
   ## What changes are included in this PR?
   
   - Advertise `NULLS FIRST` for growing frames and `NULLS LAST` for shrinking 
frames.
   - Accept either NULL placement when the current row guarantees a non-NULL 
aggregate result, preserving sort elision for the existing running `SUM` case.
   - Add six SQL regression cases and update five optimizer plan expectations. 
Bounded sliding frames are tracked in #27422.
   
   ## What is the testing strategy for this PR?
   
   - `window.slt`, `order.slt`, and `sort_pushdown.slt`
   - All 64 `enforce_sorting_monotonicity` tests
   - The full workspace suite remains pending.
   
   ## Are there any user-facing changes?
   
   Queries over growing and shrinking aggregate windows now honor the requested 
NULL placement. The public `AggregateFunctionExpr::get_result_ordering` method 
reports `NULLS FIRST` for growing frames.
   


-- 
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]

Reply via email to