[ https://issues.apache.org/jira/browse/CALCITE-4505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17288534#comment-17288534 ]
Julian Hyde commented on CALCITE-4505: -------------------------------------- While {{SqlValidator.Config.DEFAULT.withIdentifierExpansion(true)}} may solve this particular problem, it will alter a lot of other behavior and I doubt that it is the right solution here. I think that there have been previous issues with expression expansion - either the expansion was lost, or the expanded expression did not have a registered type. I'd start by searching for these. > 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)