You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "yanjing.wang (Jira)" <ji...@apache.org> on 2021/02/20 09:34:00 UTC

[jira] [Commented] (CALCITE-4505) SqlToRelConverter should support converting in condition in agg function

    [ https://issues.apache.org/jira/browse/CALCITE-4505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17287614#comment-17287614 ] 

yanjing.wang commented on CALCITE-4505:
---------------------------------------

after i dive into flink and debug count if, i find the difference. calcite 

'identifierExpansion' in SqlValidator.Config.DEFAULT is false, but 'deriveTypeImpl' method use expanded select list, so that invoking

'getValidatedNodeTypeIfKnown' method returns null, then can't register 'in' subquery in 'findSubQueries' method.

 

change to SqlValidator.Config.DEFAULT.withIdentifierExpansion(true) resolved. but i think it should be default.

> SqlToRelConverter should support converting in condition in agg function
> ------------------------------------------------------------------------
>
>                 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)