Multiple and operators in single case when statement

Hi,

We are running on 0.11.0 and I am facing issues while querying for multiple AND operator conditions in a single case when clause. I am querying using json sql query mode. Here is an example :

{“query” : “SELECT demographic_gender,CASE WHEN (telco_arpu > 141 and telco_arpu <= 373 and telco_datausage <= 998) THEN ‘Low’ ELSE null END AS demographic_incomebucket,count(distinct impressions) as impressions FROM “zai-v2-ind” WHERE (input_sourceid = ‘100’ AND cast(__time as date) >= ‘2017-12-01’ AND cast(__time as date) <= ‘2018-03-05’ AND profile_flag = ‘true’) GROUP BY demographic_gender,CASE WHEN (telco_arpu > 141 and telco_arpu <= 373 and telco_datausage <= 998) THEN ‘Low’ ELSE null END”}

And following is the error :

{“error”:“Unknown exception”,“errorMessage”:"Error while applying rule DruidQueryRule:SELECT_PROJECT, args [rel#4844:LogicalProject.NONE.(input=rel#4842:Subset#6.NONE.,demographic_gender=$4,demographic_incomebucket=CASE(AND(>($36, 141), <=($36, 373), <=($38, 998)), ‘Low’, null),impressions=$19) …(followed by query, fields, columns, signature etc.)

Query with two or less expressions for AND operator works fine. Is this expected ? Any help would be appreciated.

Thanks,

Shubham Patil

Hi Shubham,

Looks like a bug, I raised an issue here: https://github.com/druid-io/druid/issues/5468. Thanks for reporting it.