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

Xuefu Zhang commented on HIVE-19671:
------------------------------------

Based on your analysis, it seems that random(see) depends on a deterministic 
order of the data. Reading HDFS may guarantee the order, but probably not every 
data source has such guaranty. Also, a map or reduce logic may also generate 
nondeterministic order. Having said that, it appears to me that any 
partitioning that depends on a deterministic ordering of the data is doomed, 
include rand() and rand(seed). This is rather a user problem, for which I'm not 
sure if Hive needs to do anything. We may document this as a general bad 
practice, but blocking solves rand() problemI  but doesn't help other similar 
problems. I suggest we leave it to user to solve the problem. Thoughts?

> Distribute by rand() can lead to data inconsistency
> ---------------------------------------------------
>
>                 Key: HIVE-19671
>                 URL: https://issues.apache.org/jira/browse/HIVE-19671
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Rui Li
>            Assignee: Rui Li
>            Priority: Major
>
> Noticed the following queries can give different results:
> {code}
> select count(*) from tbl;
> select count(*) from (select * from tbl distribute by rand()) a;
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to