@@ -58,9 +58,10 @@ public void tearDown() {
5858 }
5959
6060 // Verify that computeBatch is consistent with computeNext: when the running sum
61- // overflows to +Infinity, the next finite batch overwrites it (resets the accumulator).
61+ // overflows to +Infinity, it is preserved. AvgDouble's computeNext uses addDouble
62+ // with no inner guard, so Infinity + finite = Infinity naturally.
6263 @ Test
63- public void testAvgDoubleBatchAccumulatedInfinityIsOverwritten () {
64+ public void testAvgDoubleBatchAccumulatedInfinityIsPreserved () {
6465 AvgDoubleGroupByFunction function = new AvgDoubleGroupByFunction (DoubleColumn .newInstance (COLUMN_INDEX ));
6566 try (SimpleMapValue value = prepare (function )) {
6667 // Batch 1: running sum = MAX_VALUE (finite)
@@ -71,12 +72,12 @@ public void testAvgDoubleBatchAccumulatedInfinityIsOverwritten() {
7172 ptr = allocateDoubles (Double .MAX_VALUE );
7273 function .computeBatch (value , ptr , 1 , 0 );
7374
74- // Batch 3: Infinity is not finite, so the accumulator resets to 1.0
75+ // Batch 3: Infinity is preserved, not overwritten
7576 ptr = allocateDoubles (1.0 );
7677 function .computeBatch (value , ptr , 1 , 0 );
7778
78- // avg = 1.0 / 3 (count is still 3)
79- Assert .assertEquals ( 1.0 / 3.0 , function .getDouble (value ), 1e-15 );
79+ // avg = Infinity / 3 = Infinity
80+ Assert .assertTrue ( Double . isInfinite ( function .getDouble (value )) );
8081 }
8182 }
8283
0 commit comments