morrySnow opened a new pull request, #64864:
URL: https://github.com/apache/doris/pull/64864

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: None
   
   Problem Summary: nth_value over an upper-bounded/lower-unbounded window 
frame such as ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING is normalized by 
reversing the order and frame, then evaluating nth_value with a negative offset 
over a cumulative frame. The BE nth_value window state replaced the tracked 
frame row count on each range update, so later rows in the cumulative frame 
could address the wrong row or return NULL. The fix keeps the cumulative frame 
row count across range updates, and FE preserves literal offset typing when 
negating bigint nth_value arguments. This adds BE unit coverage for the 
reversed cumulative execution path and a regression case comparing nth_value to 
lead for the original SQL frame.
   
   ### Release note
   
   Fix nth_value results for ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING 
window frames.
   
   ### Check List (For Author)
   
   - Test: Regression test; style check
       - Regression test: `./run-regression-test.sh --run -d 
query_p0/sql_functions/window_functions -s test_nthvalue_function -forceGenOut`
       - Style check: `build-support/check-format.sh`
       - Unit Test: BE UT added but not completed locally because the ASAN UT 
build was too slow in this environment
   - Behavior changed: Yes. Fixes incorrect nth_value results for 
upper-bounded/lower-unbounded window frames.
   - Does this need documentation: No
   


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