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

zhengdong commented on CALCITE-1381:
------------------------------------

Sorry for misunderstanding your advice in email.
Could you help to review the new patch file I have attached?

And I don't have any knowledge of how to use .iq file. Could you help to add 
the test case or explain further more about how should I do?

> Function quantifier should be retained in a cloned Sql call 
> ------------------------------------------------------------
>
>                 Key: CALCITE-1381
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1381
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.8.0, 1.6.0
>            Reporter: zhengdong
>            Assignee: Julian Hyde
>            Priority: Minor
>         Attachments: 
> 0001-Override-clone-method-in-SqlBasicCall-to-fix-Nullif-function.patch, 
> CALCITE-1381-Function-quantifier-should-be-retained-.patch
>
>
> I found Calcite can’t execute queries like ‘select nullif(count(distinct 
> colunm),0) from table ’, and dumped ‘Plan after trimming unused fields’ like 
> this:
>                       LogicalProject(NAME=[$0], GENDER=[CASE(=($1, 0), null, 
> CAST($2):BIGINT)])
>                          LogicalAggregate(group=[{0}], agg#0=[COUNT(DISTINCT 
> $1)], agg#1=[COUNT($1)])
>                            LogicalProject(NAME=[$1], GENDER=[$3])
>                              CsvTableScan(table=[[SALES, EMPS]], fields=[[0, 
> 1, 2, 3, 4, 5, 6, 7, 8, 9]])
> Then, I checked SqlNullifFunction rewriteCall method which used 
> SqlNode.clone(SqlParserPos pos) method to create SqlCase call.
> Finally, I guess the root cause may be that the clone(SqlParserPos pos) 
> method discard the functionQuantifier which holds such as ‘distinct’ symbol 
> when create new SqlCall instance.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to