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

Muhammad Gelbana commented on CALCITE-1436:
-------------------------------------------

Would someone please shed some light on what needs to be done here ? I believe 
[~vladimirsitnikov]\[~vlsi] is the author of [this 
change|[https://github.com/apache/calcite/commit/ddad58826121d29362539f240ea32660811dc09b#diff-964b02bd21a99d18828586e07bb88aa7].]
 Would you please provide more information ?

I can think of two ways to fix this. I either create an accumulator following 
the same interface as IntSum, LongSum and DoubleSum and
{code:java}
return new UdaAccumulatorFactory(AggregateFunctionImpl.create(IntMin.class), 
call, true); // That's for Integral input{code}
Just as what the SUM branch does.

Or,

Considering that I'm trying to support MIN and MAX aggregate functions, I'll 
have to initialize the *state* list with only one element that represents the 
calculated minimum\maximum value. Should this expression be of type 
ParameterExpression ? This will have to be done in the AggImpState constructor 
of course. But this is still complicated to me, I appreciate some 
clarifications please.

 

> AggregateNode NPE for aggregators other than SUM/COUNT
> ------------------------------------------------------
>
>                 Key: CALCITE-1436
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1436
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Gian Merlino
>            Assignee: Julian Hyde
>            Priority: Major
>
> AggregateNode.getAccumulator does this for any aggregation other than COUNT 
> or SUM:
>       final AggImpState agg = new AggImpState(0, call, false);
>       int stateSize = agg.state.size();
> This NPEs because "state" is null on freshly created AggImpState instances.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to