[
https://issues.apache.org/jira/browse/CALCITE-7864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-7864.
----------------------------------
Fix Version/s: 1.43.0
Resolution: Fixed
Fixed in
[https://github.com/apache/calcite/commit/4681d4d16af74e9da5f2b5105e9e07b1836ff000]
Thank you for the contribution [~letian-jiang]
> RANGE window frames should handle NULL ORDER BY keys
> ----------------------------------------------------
>
> Key: CALCITE-7864
> URL: https://issues.apache.org/jira/browse/CALCITE-7864
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Letian Jiang
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.43.0
>
>
> EnumerableWindow throws a NullPointerException when evaluating
> a RANGE frame with an offset bound and a NULL ORDER BY key,
> because the generated boundary arithmetic unboxes the NULL key.
> Reproducer:
> 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)
> Expected results, ignoring row order:
> (1, 10), (2, 30), (NULL, 300), (NULL, 300).
> Actual result: NullPointerException.
> Offset RANGE boundaries for a NULL key should use the corresponding
> edge of its NULL peer group. This should work with both NULLS FIRST
> and NULLS LAST, for both lower and upper bounds.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)