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

   - A query like:
   ```
   select AirlineID,
     datetimeconvert(
       min(
         CASE
           WHEN Year = 2014 THEN NULL
           ELSE ts
         END
       ),
       '1:MILLISECONDS:EPOCH',
       '1:MILLISECONDS:SIMPLE_DATE_FORMAT:yyyy-MM-dd HH:mm:ss.SSS 
tz(Asia/Seoul)',
       '1:MILLISECONDS'
     ) as "taskStartTs"
   from airlinestats
   group by AirlineID
   limit 1000
   ```
   results in the following error currently:
   ```
   java.lang.NullPointerException: Cannot invoke "Object.toString()" because 
"value" is null
        at 
org.apache.pinot.common.utils.PinotDataType$8.toString(PinotDataType.java:469)
        at 
org.apache.pinot.common.utils.PinotDataType$11.convert(PinotDataType.java:653)
        at 
org.apache.pinot.common.utils.PinotDataType$11.convert(PinotDataType.java:603)
        at 
org.apache.pinot.core.query.postaggregation.PostAggregationFunction.invoke(PostAggregationFunction.java:98)
        at 
org.apache.pinot.core.query.reduce.PostAggregationHandler$PostAggregationValueExtractor.extract(PostAggregationHandler.java:183)
        at 
org.apache.pinot.core.query.reduce.PostAggregationHandler.getResult(PostAggregationHandler.java:99)
        at 
org.apache.pinot.core.query.reduce.GroupByDataTableReducer.calculateFinalResultRows(GroupByDataTableReducer.java:460)
        at 
org.apache.pinot.core.query.reduce.GroupByDataTableReducer.reduceResult(GroupByDataTableReducer.java:213)
   ```
   
   ```
   2025/08/29 13:41:49.338 ERROR [WebApplicationExceptionMapper] 
[grizzly-http-server-14] Server error: 
   java.io.IOException: HTTP error code: 500. Root Cause: Cannot invoke 
"Object.toString()" because "value" is null
        at 
org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestRaw(PinotQueryResource.java:506)
        at 
org.apache.pinot.controller.api.resources.PinotQueryResource.lambda$sendRequestRaw$2(PinotQueryResource.java:524)
        at 
org.glassfish.jersey.message.internal.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:55)
   ```
   - The reason is that the single-stage engine's `PostAggregationFunction` 
doesn't handle null values appropriately during type conversion. This logic 
already exists in `FunctionInvoker` which can be used directly.


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