Uploaded image for project: 'Crunch'
  1. Crunch
  2. CRUNCH-503

Behavior of MAX_N Aggregator for duplicate values is counter-intuitive

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.11.0
    • Fix Version/s: 0.12.0
    • Component/s: Core
    • Labels:
      None

      Description

      I would expect code below to return {1, 2, 3}. Instead, it returns {2, 3}.

      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()));
          }
      }
      

        Attachments

        1. CRUNCH-503.patch
          8 kB
          Josh Wills
        2. CRUNCH-503b.patch
          9 kB
          Josh Wills

          Activity

            People

            • Assignee:
              jwills Josh Wills
              Reporter:
              tychol Tycho Lamerigts
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: