You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by Siddhi Mehta <sm...@gmail.com> on 2016/04/13 02:51:22 UTC
Using Hive UDF in pig
Hey Guys,
I have created a custom Hive UDF and have registered it as a permanent
function using
CREATE FUNCTION myfunc AS 'com.package.mycustomfunc' USING JAR
'applog-udf.jar', FILE 'distributedcachedir;
I want to make use of the same hive udf in pig as per jira PIG-3294
<https://issues.apache.org/jira/browse/PIG-3294>.
I am able to successfully use the udf if I define it using the full class
name
define myfunc HiveUDF('com.package.mycustomfunc');
My assumption was that custom UDF's can also be defined using the
functionName/alias rather than the classname.
When I try to do the same I keep getting errors since it cannot resolve the
udf name using builtins
define myfunc HiveUDF('default.myfunc');
Is this assumption correct or do custom hive udf's need to be referenced
via their full class name
--Siddhi
Re: Using Hive UDF in pig
Posted by Alan Gates <al...@gmail.com>.
Pig does not have access to Hive’s metastore to locate default functions, so you will have to use the full class name.
Alan.
> On Apr 13, 2016, at 01:51, Siddhi Mehta <sm...@gmail.com> wrote:
>
> Hey Guys,
>
> I have created a custom Hive UDF and have registered it as a permanent
> function using
>
> CREATE FUNCTION myfunc AS 'com.package.mycustomfunc' USING JAR
> 'applog-udf.jar', FILE 'distributedcachedir;
>
>
> I want to make use of the same hive udf in pig as per jira PIG-3294
> <https://issues.apache.org/jira/browse/PIG-3294>.
>
>
> I am able to successfully use the udf if I define it using the full class
> name
>
> define myfunc HiveUDF('com.package.mycustomfunc');
>
>
> My assumption was that custom UDF's can also be defined using the
> functionName/alias rather than the classname.
>
>
> When I try to do the same I keep getting errors since it cannot resolve the
> udf name using builtins
>
>
> define myfunc HiveUDF('default.myfunc');
>
>
> Is this assumption correct or do custom hive udf's need to be referenced
> via their full class name
>
> --Siddhi