xiangfu0 opened a new pull request, #19543:
URL: https://github.com/apache/pinot/pull/19543

   Grouped SSE queries can retain an intermediate `OBJECT` column type after 
the broker has finalized `AVG` into a `DOUBLE`. This happens when the indexed 
table is built from a different server response than the response that supplied 
the broker's canonical schema. It reports the wrong result type and can make 
`HAVING` fail with `Cannot convert ColumnDataType: OBJECT to DataType`.
   
   Derive final aggregate types explicitly after merging and finalization, 
preserving the canonical column names and group-key types. The change is 
limited to final broker reduction; intermediate merge-only responses keep their 
partial states.
   
   ### Reproduction
   
   Reduce two separately serialized server responses for the same group with 
AVG partials `(sum=0, count=1)` and `(sum=900, count=9)`. Supply the first 
response's schema while iterating the second response first.
   
   ```sql
   SELECT k, AVG(v) AS mean FROM test GROUP BY k ORDER BY mean;
   SELECT k, AVG(v) + 1 AS mean FROM test
   GROUP BY k HAVING AVG(v) > 80 ORDER BY mean;
   ```
   
   Before the fix, the first result is incorrectly typed `OBJECT` and the 
second query fails while constructing the HAVING matcher. The regression tests 
cover both response orders, actual DataTable serialization, weighted AVG 
results of `90.0` / `91.0`, and final `DOUBLE` result schemas. Both regression 
cases failed before the fix.
   
   ### Validation
   
   - JDK 25: `GroupByFinalSchemaTest`, `MergeDataTablesOnlyTest`, and 
`ReducerDataSchemaUtilsTest`: **33 tests passed** on this PR head.
   - `spotless:apply`, `license:format`, `checkstyle:check`, and 
`license:check`: passed without changes.
   - Focused `test-compile` through the test lifecycle with `-Xlint:all`: no 
warnings on added lines.
   - The separate `-am` reactor attempt stopped in unchanged 
`pinot-segment-local` code: `ZstandardDecompressor.java:51` could not access 
`org.jetbrains.annotations.NotNull`. The focused tests passed using the 
installed dependencies; no unrelated dependency change is included.
   
   ```sh
   ./mvnw -pl pinot-core \
     
-Dtest=GroupByFinalSchemaTest,MergeDataTablesOnlyTest,ReducerDataSchemaUtilsTest
 \
     -Dsurefire.failIfNoSpecifiedTests=false test
   ```
   


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

Reply via email to