[ https://issues.apache.org/jira/browse/HIVE-9534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14529304#comment-14529304 ]
Chaoyu Tang commented on HIVE-9534: ----------------------------------- Looks like that the over(analytic_clause) part will be ignored in a query with distinct in Hive: {code} function @init { gParent.pushMsg("function specification", state); } @after { gParent.popMsg(state); } : functionName LPAREN ( (STAR) => (star=STAR) | (dist=KW_DISTINCT)? (selectExpression (COMMA selectExpression)*)? ) RPAREN (KW_OVER ws=window_specification)? -> {$star != null}? ^(TOK_FUNCTIONSTAR functionName $ws?) -> {$dist == null}? ^(TOK_FUNCTION functionName (selectExpression+)? $ws?) -> ^(TOK_FUNCTIONDI functionName (selectExpression+)?) ; {code} the query like: select avg(distinct col1) over() from testwindow; or select avg(distinct col1) over(order by col2 rows between 1 preceding and 1 following) from testwindow; the over(...) is totally ignored. So I am going to fix this issue by throwing out unsupported error. > incorrect result set for query that projects a windowed aggregate > ----------------------------------------------------------------- > > Key: HIVE-9534 > URL: https://issues.apache.org/jira/browse/HIVE-9534 > Project: Hive > Issue Type: Bug > Components: SQL > Reporter: N Campbell > Assignee: Chaoyu Tang > > Result set returned by Hive has one row instead of 5 > {code} > select avg(distinct tsint.csint) over () from tsint > create table if not exists TSINT (RNUM int , CSINT smallint) > ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' > STORED AS TEXTFILE; > 0|\N > 1|-1 > 2|0 > 3|1 > 4|10 > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)