JackieTien97 opened a new pull request, #18300:
URL: https://github.com/apache/iotdb/pull/18300

   ## Description
   
   Fix table-model grouped `MAX` returning `NULL` when every `FLOAT` or `DOUBLE`
   value in a group is zero or negative.
   
   `GroupedMaxAccumulator` initialized floating-point states with 
`Float.MIN_VALUE`
   and `Double.MIN_VALUE`. In Java, those constants are the smallest positive
   values, not the most negative values. As a result, non-positive inputs never
   initialized the group state, and the final result was emitted as `NULL`.
   
   `MAX_BY` was unaffected because its implementation explicitly handles the 
first
   input value.
   
   ## Changes
   
   - Initialize grouped floating-point `MAX` states with negative infinity.
   - Add unit coverage for zero, negative, and negative-infinity values for both
     raw and intermediate inputs.
   - Verify that groups with no input still return `NULL`.
   - Add a table-model SQL regression test covering the non-stream grouped
     aggregation path.
   
   ## User impact
   
   Grouped `MAX(FLOAT)` and `MAX(DOUBLE)` now return the correct value for 
groups
   whose maximum is non-positive, including all-zero groups.
   
   ## Validation
   
   ```shell
   mvn clean test -pl iotdb-core/calc-commons \
     -Dtest=GroupedMaxAccumulatorTest
   
   mvn clean verify -Drat.skip=true -DskipUTs \
     -Dit.test=IoTDBTableAggregationNonStreamIT#maxNonPositiveFloatingPointTest 
\
     -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false \
     -pl integration-test -am -PTableSimpleIT -P with-integration-tests
   ```
   
   The targeted integration test passed and the 37-module clean reactor build
   completed successfully.
   


-- 
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]

Reply via email to