Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

HIVE UDF is not working using java

HIVE UDF is not working using java

New Contributor

Dear Gents,

I am using Cloudera QuickStart (CDH 5.13.0, Packages)

I have created  JAVA UDF function named omlower as test case for HIVE UDF using JAVA.

but it is not working and return this error 

"Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask"

I used these steps

1- Create omlower.java file with this content


package com.example.hive.udf;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;

public final class omlower extends UDF {

public Text evaluate(final Text s) {
if (s == null) { return null; }
return new Text(s.toString().toLowerCase());
}
}

 

2- compile is succesfully using [cloudera@quickstart ~]$ javac omlower.java -cp $(hadoop classpath)

 

3- create Jar file using [cloudera@quickstart ~]$ jar -cvf omlower.jar omlower.class -cp $(hadoop classpath)

 

4- copy JAR file to HDFS directory /user

5- using HUE UI and HIVE editor , I tried to create UDF Function

CREATE FUNCTION omlower AS 'com.example.hive.udf.omlower' USING JAR 'hdfs:/user/omlower.jar';

but it gives this error "Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask"

any help please

 

Regards

Omran

 

Don't have an account?
Coming from Hortonworks? Activate your account here