xuzifu666 commented on code in PR #5178: URL: https://github.com/apache/calcite/pull/5178#discussion_r3788361613
########## core/src/test/resources/sql/winagg.iq: ########## @@ -1323,4 +1323,76 @@ java.sql.SQLException: Error while executing SQL "select first_value(sal) filter from emp": FILTER clause is not supported for window function FIRST_VALUE !error +# [CALCITE-7701] Support IGNORE NULLS for FIRST_VALUE/LAST_VALUE window functions in the enumerable convention +# Verified against Oracle +# FIRST_VALUE with IGNORE NULLS returns the first non-null value in the frame +# (or NULL if the frame is empty or all values are null). +select o, v, Review Comment: Good catch. I've added test coverage for unbounded ROWS windows, the default RANGE frame (RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), symmetric RANGE windows (RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING), and RANGE peers.The IGNORE NULLS implementation scans from startIndex() to endIndex() (forward for FIRST_VALUE, backward for LAST_VALUE), so it works for any frame type that EnumerableWindow produces, including ROWS and RANGE. The new tests verify the expected behavior for these cases: https://onecompiler.com/oracle/44y9pceqr -- 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]
