hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danran Lai (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HIVE-7400) count and count distinct not correct
Date Tue, 15 Jul 2014 03:52:04 GMT

     [ https://issues.apache.org/jira/browse/HIVE-7400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Danran Lai updated HIVE-7400:
-----------------------------

    Description: 
I have a table in Hive and I want to count unique records and all records.
Table looks like:
{quote}       
sid                     string                   
sender                   string                                     
domain                  string       
product                 string
{quote}
And my query like this:
{quote}
select domain,product,count(1) as num,count(distinct sender)  as user_num
from table
group by domain,product
{quote}
But the results are not correct. I can get the right user_num, but the num is wrong which
is less than the real num. The real num is about 30 millon but I can only get 9 millon. 
So how can I fix this so that I get the correct result?

==================Updated==========================
Dataset is uploaded. Row format delimited fields terminated by '\t'. This dataset has 150,000
rows. With this query, I got the result as followed:
bq.domain1 product1        36424   36424

  was:
I have a table in Hive and I want to count unique records and all records.
Table looks like:
{quote}       
sid                     string                   
sender                   string                                     
domain                  string       
product                 string
{quote}
And my query like this:
{quote}
select domain,product,count(1) as num,count(distinct sender)  as user_num
from table
group by domain,product
{quote}
But the results are not correct. I can get the right user_num, but the num is wrong which
is less than the real num. The real num is about 30 millon but I can only get 9 millon. 
So how can I fix this so that I get the correct result?

==================Updated==========================
Dataset is uploaded. This dataset has 49,9899 rows. With this query, I got the result as followed:
bq.domain1 product1        131489  114709


> count and count distinct not correct
> ------------------------------------
>
>                 Key: HIVE-7400
>                 URL: https://issues.apache.org/jira/browse/HIVE-7400
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 0.11.0
>            Reporter: Danran Lai
>
> I have a table in Hive and I want to count unique records and all records.
> Table looks like:
> {quote}       
> sid                     string                   
> sender                   string                                     
> domain                  string       
> product                 string
> {quote}
> And my query like this:
> {quote}
> select domain,product,count(1) as num,count(distinct sender)  as user_num
> from table
> group by domain,product
> {quote}
> But the results are not correct. I can get the right user_num, but the num is wrong which
is less than the real num. The real num is about 30 millon but I can only get 9 millon. 
> So how can I fix this so that I get the correct result?
> ==================Updated==========================
> Dataset is uploaded. Row format delimited fields terminated by '\t'. This dataset has
150,000 rows. With this query, I got the result as followed:
> bq.domain1 product1        36424   36424



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message