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

Mehant Baid commented on CALCITE-766:
-------------------------------------

You are right ensureType() will do what is expected when we pass true for 
'matchNullability'. 

However do you think there might be a bug in 
[RexBuilder.makeOver()|https://github.com/apache/incubator-calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexBuilder.java#L363]
 when it rewrites an aggregate function. For example it rewrites sum over 
(partition by) as case when count > 0 then *sum0* else null; The output type of 
sum is a nullable type and output type of sum0 is non-nullable so while 
invoking ensureType() we need to make sure nullability is ignored, which is not 
happening currently. 



> RexBuilder.ensureType() does not correctly handle the case when nullability 
> needs to be ignored
> -----------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-766
>                 URL: https://issues.apache.org/jira/browse/CALCITE-766
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Mehant Baid
>            Assignee: Julian Hyde
>
> In ensureType() we don't correctly handle the case when nullability should be 
> ignored. We still compare digests of the two types which returns false even 
> when the types are the same but differ only in nullability. 
> Created a [Pull Request|https://github.com/apache/incubator-calcite/pull/97] 
> with the description of the issue and a unit test. 



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

Reply via email to