crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Wills (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CRUNCH-503) Behavior of MAX_N Aggregator for duplicate values is counter-intuitive
Date Thu, 19 Mar 2015 15:46:39 GMT

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

Josh Wills commented on CRUNCH-503:
-----------------------------------

Agree that the current answer is wrong, but couldn't we make an argument that [3, 3, 2] as
the right answer as well? Maybe an option to the method to specify how duplicate values should
be handled?

> Behavior of MAX_N Aggregator for duplicate values is counter-intuitive
> ----------------------------------------------------------------------
>
>                 Key: CRUNCH-503
>                 URL: https://issues.apache.org/jira/browse/CRUNCH-503
>             Project: Crunch
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.11.0
>            Reporter: Tycho Lamerigts
>            Assignee: Josh Wills
>
> I would expect code below to return \{1, 2, 3\}. Instead, it returns \{2, 3\}.
> {code}
> public class MaxNAggregatorTest {
>     @Test
>     public void duplicateMaxNValueShouldBeIgnored() {
>         Aggregator<Integer> myAggregator = Aggregators.MAX_N(3, Integer.class);
>         myAggregator.reset();
>         myAggregator.update(1);
>         myAggregator.update(2);
>         myAggregator.update(3);
>         myAggregator.update(3);
>         assertEquals(3, Iterables.size(myAggregator.results()));
>     }
> }
> {code}



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

Mime
View raw message