You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Alessandro Solimando (Jira)" <ji...@apache.org> on 2022/11/22 09:59:00 UTC

[jira] [Commented] (HIVE-26683) Sum over window produces 0 when row contains null

    [ https://issues.apache.org/jira/browse/HIVE-26683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17637130#comment-17637130 ] 

Alessandro Solimando commented on HIVE-26683:
---------------------------------------------

+1 from me, it's always unfortunate to make breaking changes, but in this case the current behaviour seems inconsistent and broken (surprising to see 0, I agree it should be a NULL), we should fix it IMO.

> Sum over window produces 0 when row contains null
> -------------------------------------------------
>
>                 Key: HIVE-26683
>                 URL: https://issues.apache.org/jira/browse/HIVE-26683
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>            Reporter: Steve Carlin
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Ran the following sql:
>  
> {code:java}
> create table sum_window_test_small (id int, tinyint_col tinyint);
> insert into sum_window_test_small values (5,5), (10, NULL), (11,1);
> select id,
> tinyint_col,
> sum(tinyint_col) over (order by id nulls last rows between 1 following and 1 following)
> from sum_window_test_small order by id;
> select id,
> tinyint_col,
> sum(tinyint_col) over (order by id nulls last rows between current row and 1 following)
> from sum_window_test_small order by id;
> {code}
> The result is
> {code:java}
> +-----+--------------+---------------+
> | id  | tinyint_col  | sum_window_0  |
> +-----+--------------+---------------+
> | 5   | 5            | 0             |
> | 10  | NULL         | 1             |
> | 11  | 1            | NULL          |
> +-----+--------------+---------------+{code}
> The first row should have the sum as NULL
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)