You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "N Campbell (JIRA)" <ji...@apache.org> on 2013/10/06 18:52:41 UTC

[jira] [Created] (HIVE-5467) allow null ordering specification in a windowed aggregate

N Campbell created HIVE-5467:
--------------------------------

             Summary: allow null ordering specification in a windowed aggregate
                 Key: HIVE-5467
                 URL: https://issues.apache.org/jira/browse/HIVE-5467
             Project: Hive
          Issue Type: Improvement
    Affects Versions: 0.11.0
            Reporter: N Campbell


A business user may require that nulls are sorted first with respect to an analytical expression as opposed to last. Hive does not support the null ordering specification.

select rnum, c1, c2, c3, rank() over(order  c1 desc nulls first  ) from tolap order by rnum
Error: Query returned non-zero code: 40000, cause: FAILED: ParseException line 1:37 cannot recognize input near 'order' 'c1' 'desc' in order by clause


You can fake is by ordering on a case expression

select rnum, c1, c2, c3, rank() over(order by case when c1 is null then 0 else 1 end, c1 desc  ) from tolap order by rnum




--
This message was sent by Atlassian JIRA
(v6.1#6144)