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

Vladimir Sitnikov commented on CALCITE-4234:
--------------------------------------------

 !AggregateCall_init.png!  !AggregateCall_create.png!  
!RelBuilder_aggregateCall.png! 

It looks like type is passed to a static method 
{{org.apache.calcite.rel.core.AggregateCall#create(org.apache.calcite.sql.SqlAggFunction,
 boolean, boolean, boolean, java.util.List<java.lang.Integer>, int, 
org.apache.calcite.rel.RelCollation, org.apache.calcite.rel.type.RelDataType, 
java.lang.String)}} as is, then it is passed to {{AggregateCall}} which does 
{{requireNonNull(type)}} it the very first line of the constructor.

It is not like a top priority, however, it was strange to me, so I logged a 
jira case.

> RelBuilder.AggCallImpl#aggregateCall() throws NullPointerException
> ------------------------------------------------------------------
>
>                 Key: CALCITE-4234
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4234
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: core
>    Affects Versions: 1.25.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>         Attachments: AggregateCall_create.png, AggregateCall_init.png, 
> RelBuilder_aggregateCall.png
>
>
> CALCITE-4220 introduced the following method:
> {code:java}
>     @Override public AggregateCall aggregateCall() {
>       return AggregateCall.create(aggFunction, distinct, approximate,
>           ignoreNulls, ImmutableList.of(), -1, /* collation: */ null, /* 
> type: */ null, alias);
>     }
> {code}
> In practice {{AggregateCall}} constructor has {{null}} checks, so 
> {{aggregateCall}} would always throw NPE:
> {code:java}
>     this.type = Objects.requireNonNull(type);
>     this.collation = Objects.requireNonNull(collation);
> {code}
> [~julianhyde], would you please check if that behavior is expected?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to