houserjohn opened a new pull request, #14238:
URL: https://github.com/apache/lucene/pull/14238

   ### Description
   
   Adds additional unit tests to increase coverage of Dynamic Range Faceting.
   - Adds tests for varying TopN values
   - Adds test for inputs with the same weights
   - Adds tests that randomly shuffle the inputs
   - Adds test for a single misplaced value
   - Adds randomized test that is checked based on the properties of the ranges
   
   Performance improvements included in 
[GH#13914](https://github.com/apache/lucene/pull/13914) showed that a few more 
unit tests may be needed to have sufficient coverage. Additionally, a few other 
unit tests were added for completeness. For instance, while `LargeTopN` was 
added because it exposed a previously unfound bug, `SingleTopN` and `TwoTopN` 
were added because we were not testing small TopN values. Here a few of the 
highlighted unit tests that were previously nonexistent with their error 
messages:
   
   `testComputeDynamicNumericRangesWithMisplacedValue` (Notice values marked 
with **)
   
   >```java.lang.AssertionError: expected:<[DynamicRangeInfo[count=8, 
weight=444, min=**1**, max=104, centroid=54.5], DynamicRangeInfo[count=4, 
weight=430, min=105, max=108, centroid=106.5], DynamicRangeInfo[count=4, 
weight=446, min=109, max=112, centroid=110.5], DynamicRangeInfo[count=3, 
weight=345, min=113, max=115, centroid=114.0]]> but 
was:<[DynamicRangeInfo[count=8, weight=444, min=**12**, max=104, 
centroid=54.5], DynamicRangeInfo[count=4, weight=430, min=105, max=108, 
centroid=106.5], DynamicRangeInfo[count=4, weight=446, min=109, max=112, 
centroid=110.5], DynamicRangeInfo[count=3, weight=345, min=113, max=115, 
centroid=114.0]]>``` 
   
   `testComputeDynamicNumericRangesWithLargeTopN`
   >```   
   >     java.lang.IllegalArgumentException: All kWeights must be < 
beforeWeight + rangeWeight
      >         at 
__randomizedtesting.SeedInfo.seed([913AAD1D60B9263B:FFD4EE9EA025DBF]:0)
      >         at 
org.apache.lucene.core@11.0.0-SNAPSHOT/org.apache.lucene.util.WeightedSelector.checkArgs(WeightedSelector.java:82)
      >         at 
org.apache.lucene.core@11.0.0-SNAPSHOT/org.apache.lucene.util.WeightedSelector.select(WeightedSelector.java:57)
      >         at 
org.apache.lucene.facet.range.DynamicRangeUtil.computeDynamicNumericRanges(DynamicRangeUtil.java:266)
      >         at 
org.apache.lucene.facet.range.TestDynamicRangeUtil.testComputeDynamicNumericRangesWithLargeTopN(TestDynamicRangeUtil.java:169)
      >         at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
   
   
   `testComputeDynamicNumericRangesWithSameWeights` (Notice values marked with 
**)
   
   >```   
   >     java.lang.AssertionError: expected:<[DynamicRangeInfo[count=**25**, 
weight=1250, min=0, max=24, centroid=12.0], DynamicRangeInfo[count=25, 
weight=1250, min=25, max=49, centroid=37.0], DynamicRangeInfo[count=25, 
weight=1250, min=50, max=74, centroid=62.0], DynamicRangeInfo[count=25, 
weight=1250, min=75, max=99, centroid=87.0]]> but 
was:<[DynamicRangeInfo[count=**26**, weight=1300, min=0, max=25, 
centroid=12.5], DynamicRangeInfo[count=25, weight=1250, min=26, max=50, 
centroid=38.0], DynamicRangeInfo[count=25, weight=1250, min=51, max=75, 
centroid=63.0], DynamicRangeInfo[count=24, weight=1200, min=76, max=99, 
centroid=87.5]]>
      >         at 
__randomizedtesting.SeedInfo.seed([DA6EB4C0C0CA4022:DBA0A4538AB03899]:0)
      >         at junit@4.13.1/org.junit.Assert.fail(Assert.java:89)
      >         at junit@4.13.1/org.junit.Assert.failNotEquals(Assert.java:835)
      >         at junit@4.13.1/org.junit.Assert.assertEquals(Assert.java:120)
      >         at junit@4.13.1/org.junit.Assert.assertEquals(Assert.java:146)
      >         at 
org.apache.lucene.facet.range.TestDynamicRangeUtil.compareDynamicRangeResult(TestDynamicRangeUtil.java:361)
      >         at 
org.apache.lucene.facet.range.TestDynamicRangeUtil.assertDynamicNumericRangeResults(TestDynamicRangeUtil.java:351)
      >         at 
org.apache.lucene.facet.range.TestDynamicRangeUtil.testComputeDynamicNumericRangesWithSameWeights(TestDynamicRangeUtil.java:156)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to