https://pinot.apache.org/ logo
s

Surendra

06/15/2021, 5:38 PM
Hi, We have below query working in 0.6.0 and failing 0.7.1 with exception
2021/06/10 16:53:02.084 WARN [BaseBrokerRequestHandler] [jersey-server-managed-async-executor-100] Caught exception while updating Column names in Query 13040:  Illegal AstNode type for TransformExpressionTree: org.apache.pinot.pql.parsers.pql2.ast.StarExpressionAstNode
and if we update
else null
in case clause to
else 'null'
it's working in .7.1 , any clues ?
Copy code
select emp_id ,
id ,
max(timestampMs) as last_updated,
count(DISTINCT  case when emp_type  = 'admin' then user_count else null end) as admin_counts
from emp_events
where org_id = 987
AND timestampMs >= 1620892156939
AND timestampMs < 1621630122162
group by emp_id, id
limit 10
j

Jackie

06/15/2021, 6:08 PM
Pinot does not support
null
in query as of now. In the old version it might somehow be overridden to string
'null'
but that is not the correct semantic of the query though
This issue is revealed probably because we moved to the CalciteSqlParser, which parse
null
as real
null
instead of string
'null'
s

Surendra

06/15/2021, 6:17 PM
is there any workaround for this ?
j

Jackie

06/15/2021, 6:20 PM
Add single quotes to
null
to make it a string
'null'
s

Surendra

06/15/2021, 6:21 PM
Yeah, We did that for now.
j

Jackie

06/15/2021, 6:22 PM
Actually I think it should be faster if we split the query into 2 instead of using case to do the
emp_type
filtering
s

Surendra

06/15/2021, 6:23 PM
If possible can you share an example ?
j

Jackie

06/15/2021, 6:23 PM
Q1
Copy code
select emp_id ,
id ,
max(timestampMs) as last_updated,
from emp_events
where org_id = 987
AND timestampMs >= 1620892156939
AND timestampMs < 1621630122162
group by emp_id, id
limit 10
Q2
Copy code
select emp_id ,
id ,
count(DISTINCT user_count) as admin_counts
from emp_events
where org_id = 987
AND emp_type  = 'admin'
AND timestampMs >= 1620892156939
AND timestampMs < 1621630122162
group by emp_id, id
limit 10