dang-stripe opened a new issue, #14911:
URL: https://github.com/apache/pinot/issues/14911

   We're getting non-deterministic NPEs on a null-enabled query that looks like 
this.
   
   ```
   set enableNullHandling = true;
   select m_id,
     sum(
       case
         when outcome = 'success' then 1
         else 0
       end
     ) as success,
     sum(
       case
         when outcome = 'failed' then 1
         else 0
       end
     ) as failed,
     sum(
       case
         when outcome = 'invalid' then 1
         else 0
       end
     ) as invalid,
   from example_table 
   where
     some_filter_condition = 'value'
   group by 1
   order by (success + failed + invalid) desc
   ```
   
   Unfortunately, there's no stacktrace in the failure.
   
   ```
   [2025-01-21 22:50:01.843739] ERROR [BaseCombineOperator] [pqw-92:90] Caught 
exception while processing query: 
QueryContext{_tableName='example_table_REALTIME', _subquery=null, 
_selectExpressions=[m_id, sum(case(equals(outcome,'success'),'1','0')), 
sum(case(equals(outcome,'failed'),'1','0')), 
sum(case(equals(outcome,'invalid'),'1','0'))], _distinct=false, 
_aliasList=[null, success, failed, invalid], _filter=(some_filter_condition = 
'value'), _groupByExpressions=[m_id], _havingFilter=null, 
_orderByExpressions=null, _limit=10, _offset=0, 
_queryOptions={enableNullHandling=true}, _expressionOverrideHints={}, 
_explain=false} [2025-01-21 22:50:01.843748] java.lang.NullPointerException: 
null
   ```
   
   Switching it to use `COUNT(*) FILTER` instead of sum/case/when works 
reliably.
   
   ```
   COUNT(*) FILTER (WHERE outcome = 'success') as success,
   COUNT(*) FILTER (WHERE outcome = 'failed') as failed,
   COUNT(*) FILTER (WHERE outcome = 'invalid') as invalid,
   ```
   
   I've also confirmed there's no null values for the `outcome` field.
   
   cc @Jackie-Jiang 


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