Created 10-14-2016 11:47 PM
Hello,
I'm using the latest hortonworks release, plain installation and just created a simple UDF function for Hive:
import org.apache.hadoop.hive.ql.exec.Description; import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.io.DoubleWritable; @Description ( name="test", value="returns the sum of two double values", extended="SELECT test(a, b) from foo limit 1;" ) public class Test extends UDF { public DoubleWritable evaluate(DoubleWritable a, DoubleWritable b) { return new DoubleWritable(a.get() + b.get()); } }
Then created the jar and uploaded to server.
Added the jar to hive and created the temporary function:
add jar hdfs:/user/myuser/Test-0.0.1-SNAPSHOT.jar; create temporary function test as 'Test';
*** When I run this function with the "hdfs" user, it works PERFECT.
But when I switch to another user (myuser) and do the same procedure above, receive the following error when running the UDF:
Error while compiling statement: FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments '46.71': No matching method for class Test with (double, double). Possible choices:
Any idea why only hdfs user can run this UDF? Thank you very much.
Best regards,
Rogerio Biondi
Created 10-19-2016 02:09 AM
You added it only for the context of the user that you used when created the temporary function. If you want the function to be available for any user then create it as a permanent function (remove "temporary"):
add jar hdfs:/user/myuser/Test-0.0.1-SNAPSHOT.jar;
create function test as'Test';
This function will be available to all users until you restart Hive2 Server.
+++
Pls vote and accept best answer, if any.
Created 10-15-2016 04:36 PM
Created 10-17-2016 12:29 PM
Changed to 777 but the result is the same...
Created 10-19-2016 02:09 AM
You added it only for the context of the user that you used when created the temporary function. If you want the function to be available for any user then create it as a permanent function (remove "temporary"):
add jar hdfs:/user/myuser/Test-0.0.1-SNAPSHOT.jar;
create function test as'Test';
This function will be available to all users until you restart Hive2 Server.
+++
Pls vote and accept best answer, if any.
Created 02-27-2018 06:29 PM
Your function is expecting two double parameters, your example is sending only one.