Adding a cast around the null literal makes sense. I would use 
“rexBuilder.makeCast(type, constantNull())” rather than 
“rexBuilder.makeNullLiteral(type.getSqlTypeName())” because there’s a chance 
that the type needs precision & scale.

Can you please create a Calcite jira case and submit a pull request?

And by the way, I think I see similar patterns in 
AggregateExpandDistinctAggregatesRule, AggregateValuesRule and even 
RexBuilder.makeOver.

Julian


> On Feb 2, 2017, at 12:57 AM, Anton Mushin <anton_mus...@epam.com> wrote:
> 
> Hello community,
> I have worked for support  standard deviation/variance functions in Flink SQL 
> [1] and I got exception " Type NULL is not supported. Null values must have a 
> supported type.". 
> I started search root cause and found what problem come up from 
> AggregateReduceFunctionsRule[2].  @twalthr confirmed it after[3].
> 
> Now I have been used WA - the copy AggregateReduceFunctionsRule inside Flink 
> with changes.
> Could we resolve the problem some way?
> I look forward to your reply.
> 
> [1] https://issues.apache.org/jira/browse/FLINK-4604#
> [2] 
> https://issues.apache.org/jira/browse/FLINK-4604?focusedCommentId=15615280&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15615280
> [3] 
> https://issues.apache.org/jira/browse/FLINK-4604?focusedCommentId=15667697&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15667697
> 
> Regards,
> Anton Mushin
> 

Reply via email to