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

Eyal Allweil edited comment on DATAFU-117 at 5/9/16 8:50 AM:
-------------------------------------------------------------

Ok, I opened a review board for it - It's at https://reviews.apache.org/r/46701/

I think all your previous comments are addressed there, except for the one 
about "this.set.add(o) && (this.set.size() == maxAmount". I don't think this 
can exceed the max size, because a single add operation can only increment the 
set's size by one, and the UDF is executed in a single thread.

I ran a few tests comparing this UDF to a Pig nested foreach with DISTINCT 
followed by the builtin COUNT. On small inputs they perform about the same - 
even up to a million records - but if you have a situation with more skew (I 
checked 10 million records, with about 4 million distincts) then this UDF with 
a max value of say, 1,000,000, runs in a few minutes, and the nested 
foreach+distinct+count takes more than an hour - probably because it needs to 
keep all the distinct records in memory, rather than just reaching the desired 
threshold.


was (Author: eyal):
Ok, I opened a review board for it - can you see it? It's at 
https://reviews.apache.org/r/46701/

I think all your previous comments are addressed there, except for the one 
about "this.set.add(o) && (this.set.size() == maxAmount". I don't think this 
can exceed the max size, because a single add operation can only increment the 
set's size by one, and the UDF is executed in a single thread.

I ran a few tests comparing this UDF to a Pig nested foreach with DISTINCT 
followed by the builtin COUNT. On small inputs they perform about the same - 
even up to a million records - but if you have a situation with more skew (I 
checked 10 million records, with about 4 million distincts) then this UDF with 
a max value of say, 10000, runs in about four minutes, and the nested 
foreach+distinct+count takes more than an hour - probably because it needs to 
keep all the distinct records in memory, rather than just reaching the desired 
threshold.

> New UDF - CountDistinctUpTo
> ---------------------------
>
>                 Key: DATAFU-117
>                 URL: https://issues.apache.org/jira/browse/DATAFU-117
>             Project: DataFu
>          Issue Type: New Feature
>            Reporter: Eyal Allweil
>         Attachments: DATAFU-117-2.patch, DATAFU-117.patch
>
>
> A UDF that counts distinct tuples within a bag, but only up to a preset 
> limit. If the bag contains more distinct tuples than the limit, the UDF 
> returns the limit. 
> This UDF can run reasonably well even on large bags if the limit chosen is 
> small enough though the count is done in memory.
> We use this UDF in PayPal for filtering, when we don't need to use the actual 
> tuples afterward.



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

Reply via email to