hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ayon Sinha <>
Subject Adding UDF permanently to my Hive install
Date Wed, 10 Aug 2011 07:47:21 GMT
I know I have asked this question before but the answers didn't quite satisfy my requirements.
Our problem stems from the fact that there is not built-in UDF equivalent to yearweek of Mysql.
This gives the year + week concatenated, with the week starting on Sunday.
So we wrote our UDF but now we want it to be available to everyone in the company regardless
of how they are using Hive, through web client of CLi. I want to install this jar in a place
where it gets added to the Hive classpath (This part is not hard). Whats hard is simulating 
"create temporary function yearweek as 'classname'" 

I want the ability to have this registered permanently. I traced it down to FunctionRegistry
class where the build-ins are registered at init time and there is a statis public method
public static void registerUDF(boolean isNative, String functionName,
      Class<? extends UDF> UDFClass, boolean isOperator) {
    registerUDF(isNative, functionName, UDFClass, isOperator, functionName

which I just want to trigger like FunctionRegistry.registerUDF(true, "yearweek", myclass,
Is there any switch/setting anywhere I can trigger this ? 
I need this the most for the Hive server.
Short of patching the code, I can't seem to find a way.

Ideally there would be a version like: 
create [permanent] function yearweek as 'classname'
See My Photos on Flickr
Also check out my Blog for answers to commonly asked questions.

View raw message