houserjohn commented on PR #13914:
URL: https://github.com/apache/lucene/pull/13914#issuecomment-2638750375
This is a great improvement for Dynamic Ranges @HoustonPutman! After looking
into some more test cases, I believe there may be a bug for *some* unsorted
value lists. Consider this unit test:
```
public void testComputeDynamicNumericRangesWithMisplacedValue() {
List<DynamicRangeUtil.DynamicRangeInfo> expectedRangeInfoList = new
ArrayList<>();
long[] values =
new long[] {
1, 2, 11, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 12,
111, 112, 113, 114, 115
};
long[] weights =
new long[] {
2, 3, 12, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 13,
112, 113, 114, 115, 116
};
expectedRangeInfoList.add(new DynamicRangeUtil.DynamicRangeInfo(8, 444,
1L, 104L, 54.5D));
expectedRangeInfoList.add(new DynamicRangeUtil.DynamicRangeInfo(4, 430,
105L, 108L, 106.5D));
expectedRangeInfoList.add(new DynamicRangeUtil.DynamicRangeInfo(4, 446,
109L, 112L, 110.5D));
expectedRangeInfoList.add(new DynamicRangeUtil.DynamicRangeInfo(3, 345,
113L, 115L, 114.0D));
assertDynamicNumericRangeResults(values, weights, 4, 1646, 1665,
expectedRangeInfoList);
}
```
With the following error (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]]>
`
I have also posted a fix in the review, but there may be better solutions.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]