[
https://issues.apache.org/jira/browse/HIVE-9534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14526190#comment-14526190
]
Chaoyu Tang commented on HIVE-9534:
-----------------------------------
I tried the tests (distinct with window function) in MySQL, PostgreSQL and
Oracle with following steps:
{code}
create table testwindow (col1 int, col2 int);
insert into testwindow values (1, 1);
insert into testwindow values (1, 2);
insert into testwindow values (1, 3);
insert into testwindow values (2, 1);
insert into testwindow values (2, 2);
insert into testwindow values (3, 3);
---
select avg(distinct col1) over() from testwindow;
{code}
MySQL: did not work and got the error msg: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near '() from testwindow' at line 1
PostgreSQL: did not work and got the error msg: ERROR: DISTINCT is not
implemented for window functions Position: 8
Oracle: seemed work but I wonder if it is right, the average is right ( average
of 1, 2, 3) with 6 rows:
{code}
1 2
2 2
3 2
4 2
5 2
6 2
{code}
Hive only returns one row but with correct average: 2
> 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
>
> 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)