phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Swapna Swapna <>
Subject Re: Implement Custom Aggregate Functions in Phoenix
Date Fri, 18 Mar 2016 01:49:20 GMT
Yes, we do have support UPPER and LOWER. I just provided as an example to
refer to UDF.

For custom UDF's, i understand that we can go ahead and create custom UDF

but how do we register that function?

As per the blog, i found the below lines:

*Finally, we'll need to register our new function. For this, you'll need to
edit the ExpressionType enum and include your new built-in function.
There's room for improvement here to allow registration of user defined
functions outside of the phoenix jar. However, you'd need to be able to
ensure your class is available on the HBase server class path since this
will be executed on the server side at runtime.*

 Does that mean, to register my custom function, i should edit the
enum *exists in Phoenix and rebuild the *phoenix jar?*

On Thu, Mar 17, 2016 at 6:17 PM, James Taylor <>

> No, custom UDFs can be added dynamically as described here:
> No need to re-build Phoenix. It's
> just custom aggregates that would require rebuilding.
> FYI, we have support for UPPER and LOWER already.
> On Thu, Mar 17, 2016 at 6:09 PM, Swapna Swapna <>
> wrote:
>> Thank you James for swift response.
>> is the process (adding to phoenix-core and rebuild the jar)  remains the
>> same for custom UDF's as well  (like as for custom aggregate functions)?
>> ex: we have UDF's like  UPPER, LOWER ,etc
>> On Thu, Mar 17, 2016 at 5:53 PM, James Taylor <>
>> 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.
>>> Thanks,
>>> James
>>> On Thu, Mar 17, 2016 at 12:11 PM, Swapna Swapna <>
>>> wrote:
>>>> Hi,
>>>> 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'
>>>> Regards
>>>> Swapna
>>>> On Fri, Jan 29, 2016 at 6:31 PM, James Taylor <>
>>>> 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
>>>>> Would be great to capture your use case and requirements on the JIRA
>>>>> make sure the functionality will meet your needs.
>>>>> Thanks,
>>>>> James
>>>>> On Fri, Jan 29, 2016 at 1:47 PM, Swapna Swapna <
>>>>> > wrote:
>>>>>> Hi,
>>>>>> 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.
>>>>>> Thanks
>>>>>> Swapna

View raw message