[ https://issues.apache.org/jira/browse/CALCITE-4505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17288239#comment-17288239 ]
Julian Hyde commented on CALCITE-4505: -------------------------------------- Is there a better, more minimal test case? {{IF}} is not enabled by default, but it seems that your problem is with {{IN}}, so {{IF}} just confuses the matter. Does {{COUNT(id IN (1, 2))}} work? > SqlToRelConverter should support converting 'in condition clause' in 'agg > function' such as 'count(if(id in (1), 1, null))' to rel expression by default > -------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: CALCITE-4505 > URL: https://issues.apache.org/jira/browse/CALCITE-4505 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.26.0 > Environment: jvm: open-jdk8 > Reporter: yanjing.wang > Priority: Major > Fix For: 1.27.0 > > > String sql = "select id, name, count(if(id in (1) ,1,null)) from test.depts b > where ds > 0 group by id,name"; > ... > sqlToRelConverter.convertQuery(validatedSqlNode, false, true) > > it raise npe exception. > Caused by: java.lang.NullPointerException at > java.util.Objects.requireNonNull(Objects.java:203) at > org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4914) > at > org.apache.calcite.sql2rel.StandardConvertletTable.convertExpressionList(StandardConvertletTable.java:839) > at > org.apache.calcite.sql2rel.StandardConvertletTable.convertFunction(StandardConvertletTable.java:659) -- This message was sent by Atlassian Jira (v8.3.4#803005)