You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@crunch.apache.org by "Josh Wills (JIRA)" <ji...@apache.org> on 2015/03/19 20:48:38 UTC
[jira] [Updated] (CRUNCH-503) Behavior of MAX_N Aggregator for
duplicate values is counter-intuitive
[ https://issues.apache.org/jira/browse/CRUNCH-503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Josh Wills updated CRUNCH-503:
------------------------------
Attachment: CRUNCH-503.patch
Patch for this; fixes the behavior for MAX_N and MIN_N to include duplicate values and adds a MAX_UNIQUE_N and MIN_UNIQUE_N method for the original use case.
> 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
> Attachments: CRUNCH-503.patch
>
>
> 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)