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

Pengcheng Xiong commented on HIVE-14861:
----------------------------------------

Note that this will change the current hive behavior
{code}
create table empsalary (depname varchar(10), salary int);

Q1: SELECT sum(salary) OVER w, avg(salary) OVER w
  FROM empsalary
  WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);


Q2: SELECT sum(salary) OVER w as s , avg(salary) OVER w as a
  FROM empsalary
  WINDOW w AS (PARTITION BY depname ORDER BY salary DESC)
  order by s;

Q3: SELECT sum(salary) OVER w as s , avg(salary) OVER w as a
  FROM empsalary
  order by s
  WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);
{code}

Current hive (before this patch) will succeed on Q1 and Q3, will fail on Q2. 
Postgres will succeed on Q1 and Q2, will fail on Q3. Oracle sqlplus will fail 
Q1,2,3 as it does not support separate definition of windowing. After this 
patch, hive will follow what postgres does.

> Support precedence for set operator using parentheses
> -----------------------------------------------------
>
>                 Key: HIVE-14861
>                 URL: https://issues.apache.org/jira/browse/HIVE-14861
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Pengcheng Xiong
>            Assignee: Pengcheng Xiong
>         Attachments: HIVE-14861.01.patch, HIVE-14861.02.patch
>
>
> We should support precedence for set operator by using parentheses. For 
> example
> {code}
> select * from src union all (select * from src union select * from src);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to