Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

What the solution can add Aggregate Function in phoenix-core?

Highlighted

What the solution can add Aggregate Function in phoenix-core?

New Contributor

Hi, Hope you are well .

I get a problem for create a custom Aggregate Function in phoenix-core

this custom Aggregate Function like sumAggregateFunction, I call it ZSumAggregateFunction, also, I add some class such ZDecimalAggregator,ZSumAggregateParseNode, and anyone were related with SumAggregateFunction.


This is my idea to imitate SumAggregateFunction and anyone were related with SumAggregateFunction.

so, I add some class such as
org.apache.phoenix.expression.aggregator.ZCountAggregator
org.apache.phoenix.expression.aggregator.ZDecimalSumAggregator
org.apache.phoenix.expression.aggregator.ZDoubleSumAggregator
org.apache.phoenix.expression.aggregator.ZIntSumAggregator
org.apache.phoenix.expression.aggregator.ZLongSumAggregator
org.apache.phoenix.expression.aggregator.ZNumberSumAggregator
org.apache.phoenix.expression.aggregator.ZUnsignedIntSumAggregator
org.apache.phoenix.expression.aggregator.ZUnsignedLongSumAggregator
org.apache.phoenix.expression.function.ZCountAggregateFunction
org.apache.phoenix.expression.function.ZDelegateConstantToCountAggregateFunction
org.apache.phoenix.expression.function.ZSumAggregateFunction
org.apache.phoenix.expression.parse.ZDelegateConstantToCountParseNode
org.apache.phoenix.expression.parse.ZSumAggregateParseNode

Also, I registers two class(ZCountAggregateFunction,ZSumAggregateFunction)
into ExpressionType

but, when I run
select sum(DECI) from T1.TABLE, the result is 55(1+2+...+10),
when I run
select ZSum(DECI) from T1.TABLE, the result is 2.

so I don't know where is the place that scan a phoenix table's rows value, and aggregated these value, like Sum(X).


In ZDecialAggregator's function--Aggregate(), It's just run one time, and the value is final result


Is anybody can help me? please, I have no idea.


thank you!!!

1 REPLY 1

Re: What the solution can add Aggregate Function in phoenix-core?

New Contributor

I need help, please!thank you at all@Artem Ervits