clintropolis commented on issue #9412: Regression: SQL query with multiple 
similar CASE clauses cannot be translated to correct native json format
URL: https://github.com/apache/druid/issues/9412#issuecomment-591674647
 
 
   Thanks for the report, it looks like a couple of things are going on here.
   
   I think the new in 0.17 behavior is that _both_ of the expressions are being 
optimized into "true", my guess calcite optimizing something due to SQL lack of 
null equivalence means only the else is possible. I haven't confirmed yet, but 
I suspect #8566 might be related.
   
   Try this instead:
   
   ```
   SELECT 
        CASE WHEN cityName IS NULL THEN FALSE ELSE TRUE END AS col_a,
        CASE WHEN countryName IS NULL THEN FALSE ELSE TRUE END AS col_b
   FROM wikipedia
   GROUP BY 1, 2
   ```
    
   Anyway, the optimization calcite was doing uncovers another bug, which I 
think might be caused by the changes of #6902, which refactored druid sql to 
re-use virtual columns for the same expressions, but this appears to make 
grouping sad if both columns that are now the same virtual column are being 
grouped on.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to