[ 
https://issues.apache.org/jira/browse/HIVE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677428#action_12677428
 ] 

Richard Lee commented on HIVE-309:
----------------------------------

I guess it depends on how complex the syntax should be.  I think I'd prefer to 
keep each function definition at one line.

What do you think about this:

udf.IDENTIFIER=FUNCTIONNAME,CLASSNAME[,OPERATORTYPE,[ISOPERATOR,[DISPLAYNAME]]]
udaf.IDENTIFIER=FUNCTIONNAME,CLASSNAME[,ISOPERATOR,[DISPLAYNAME]]

here, IDENTIFIER is only used to distinguish keys within the property file.  
FUNCTIONNAME is pulled into the value so that non-word characters can be used 
(otherwise defining operators would be less useful).  The only two parts of the 
line that are required are FUNCTIONNAME and CLASSNAME.

As an example:
udf.logicaland=and,org.apache.hadoop.hive.ql.udf.UDFOPAnd,INFIX,true
udf.doubleampersand=&&,org.apache.hadoop.hive.ql.udf.UDFOPAnd,INFIX,true,and

for most other non-operator, PREFIX functions, you can simply say:
udf.month=month,org.apache.hadoop.hive.ql.udf.UDFMonth


> FunctionRegistry should allow loading UDFs and UDAFs from property file
> -----------------------------------------------------------------------
>
>                 Key: HIVE-309
>                 URL: https://issues.apache.org/jira/browse/HIVE-309
>             Project: Hadoop Hive
>          Issue Type: Improvement
>          Components: Query Processor
>            Reporter: Richard Lee
>         Attachments: hive-external-functions.diff
>
>
> FunctionRegistry.java hard code all UDF, UDAF definitions in a static 
> initializer.  There is no way to add new functions without directly modifying 
> this file.  
> FunctionRegistry SHOULD look for a property file in which new functions and 
> their implementations can be specified.  This will allow third parties to 
> extend hive without maintaining patches against the codebase. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to