letian-jiang opened a new pull request, #5337: URL: https://github.com/apache/calcite/pull/5337
## Jira Link [CALCITE-7864](https://issues.apache.org/jira/browse/CALCITE-7864) ## Changes Proposed Fix a NullPointerException when evaluating RANGE window frames with offset bounds and NULL ORDER BY keys. Guard boundary arithmetic for nullable keys and preserve NULL as the boundary search key. Explicitly box the non-NULL result to prevent implicit unboxing in the conditional expression. For NULL keys, offset lower and upper bounds resolve to the first and last NULL peers, respectively. UNBOUNDED endpoints retain their partition-boundary behavior. For example: ```sql SELECT k, SUM(v) OVER ( ORDER BY k NULLS LAST RANGE BETWEEN 1 PRECEDING AND CURRENT ROW ) AS s FROM (VALUES (1, 10), (2, 20), (CAST(NULL AS INTEGER), 100), (NULL, 200)) AS t(k, v) ``` Previously, this query threw a NullPointerException. It now returns `(1, 10), (2, 30), (NULL, 300), (NULL, 300)`, ignoring row order. Add 28 parameterized regression cases covering INTEGER/BIGINT, NULLS FIRST/LAST, offsets at both frame endpoints, and combinations with CURRENT ROW and UNBOUNDED bounds. -- 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]
