Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

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

New Contributor

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

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.