HI James/Team,

1. I'm trying to implement the generic (custom) aggregate function and using verison:  phoenix-4.6.0-HBase-0.98 with single-node (having hbase and phoenix exists in one node)

When i downloaded and installed, noticed that SumAggregateFunction.class exists in all the below mentioned jars as per bin folder :

-  phoenix-4.6.0-HBase-0.98-client.jar 

-  phoenix-4.6.0-HBase-0.98-client-minimal.jar

-  phoenix-4.6.0-HBase-0.98-client-without-hbase.jar

-  phoenix-4.6.0-HBase-0.98-server.jar

-  phoenix-4.6.0-HBase-0.98-server-without-antlr.jar

-  phoenix-core-4.6.0-HBase-0.98.jar

-  phoenix-server-4.6.0-HBase-0.98-runnable.jar 

But as the per the source code base , phoenix-4.6.0-HBase-0.98-src, aggregate source files exists in only 'phoenix-core' module. Please clarify.

2. As i found the aggregate source code functions exists in only phoenix-core' module, i've implemented the custom aggregate function and rebuild the jar 'phoenix-core-4.6.0-HBase-0.98.jar' , copied to hbase lib directory in the master/region server and restarted hbase.

3. When im trying the execute the Phoenix query through sqlline, im gettting the below error. This could be because I've not updated the client jar with my new function.

Error: ERROR 6001 (42F01): Function undefined. functionName=[mytest] (state=42F01,code=6001)org.apache.phoenix.schema.FunctionNotFoundException: ERROR 6001 (42F01): Function undefined. functionName=[mytest]

Kindly help me to know the list of jar's to be modified when implementing custom aggregate functions.

On Thu, Mar 17, 2016 at 5:53 PM, James Taylor <jamestaylor@apache.org> wrote:
Hi Swapna,
We don't support custom aggregate functions, only scalar functions (see PHOENIX-2069). For a custom aggregate function, you'd need to add them to phoenix-core and rebuild the jar. We're open to adding them to the code base if they're general enough. That's how FIRST_VALUE, LAST_VALUE, and NTH_VALUE made it in.

On Thu, Mar 17, 2016 at 12:11 PM, Swapna Swapna <talktoswapna@gmail.com> wrote:

I found this in Phoenix UDF documentation:
  • After compiling your code to a jar, you need to deploy the jar into the HDFS. It would be better to add the jar to HDFS folder configured for hbase.dynamic.jars.dir.

My question is, can that be any 'udf-user-specific' jar which need to be copied to HDFS or would it need to register the function and update the custom UDF classes inside phoenix-core.jar and rebuild the 'phoenix-core.jar'



On Fri, Jan 29, 2016 at 6:31 PM, James Taylor <jamestaylor@apache.org> wrote:
Hi Swapna,
We currently don't support custom aggregate UDF, and it looks like you found the JIRA here: PHOENIX-2069. It would be a natural extension of UDFs. Would be great to capture your use case and requirements on the JIRA to make sure the functionality will meet your needs.

On Fri, Jan 29, 2016 at 1:47 PM, Swapna Swapna <talktoswapna@gmail.com> wrote:

I would like to know the approach to implement and register custom aggregate functions in Phoenix like the way we have built-in aggregate functions like SUM, COUNT,etc

Please help.