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

Behavior of MAX_N Aggregator for duplicate values is counter-intuitive

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.11.0
    • 0.12.0
    • Core
    • 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-503b.patch
          9 kB
          Josh Wills
        2. CRUNCH-503.patch
          8 kB
          Josh Wills

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: