mustafasrepo opened a new issue, #4402:
URL: https://github.com/apache/arrow-datafusion/issues/4402

   
   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   Currently, there is no support for queries involving `MIN`, `MAX` Aggregate 
functions when run with
   
   custom window frames (queries involving window frame boundaries) such as 
below.
   
   ```sql
   SELECT
   MIN(c12) OVER (ORDER BY C12 RANGE BETWEEN 0.2 PRECEDING AND 0.2 FOLLOWING) 
as min1,
   MAX(c12) OVER (ORDER BY C12 RANGE BETWEEN 0.2 PRECEDING AND 0.2 FOLLOWING) 
as max1
   FROM aggregate_test_100
   ORDER BY C9
   LIMIT 5
   ```
   
   I want support for this functionality
   
   **Describe the solution you'd like**
   
   Each accumulator has a `retract_batch` method, this method is used, when the 
window expression contains bounded window frame boundaries. By implementing 
`retract_batch` method of `MIN`, `MAX` accumulators. We can support this 
functionality (as in the `SUM`, `COUNT` accumulators)
   
   **Describe alternatives you've considered**
   
   N.A
   
   **Additional context**
   
   There is an amortized constant method to calculate min, max values using 
heap structure described in the 
[link](https://stackoverflow.com/questions/4802038/implement-a-queue-in-which-push-rear-pop-front-and-get-min-are-all-consta).
   
   There is a [crate](https://docs.rs/moving_min_max/latest/moving_min_max/) 
implementing above algorithm.


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

Reply via email to