Mohit Rane
Mohit Rane

Reputation: 279

Hive Udf exception

I have a simple hive UDF:

package com.matthewrathbone.example;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;


@Description(
  name="SimpleUDFExample",
  value="returns 'hello x', where x is whatever you give it (STRING)",
  extended="SELECT simpleudfexample('world') from foo limit 1;"
  )
class SimpleUDFExample extends UDF {

  public Text evaluate(Text input) {
    if(input == null) return null;
    return new Text("Hello " + input.toString());
  }
}

When I am executing it using select query : select helloUdf(method) from tests3atable limit 10; method is the name of column in tests3atable table.

I am getting below exception : FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments 'method': Unable to instantiate UDF implementation class com.matthewrathbone.example.SimpleUDFExample: java.lang.IllegalAccessException: Class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge can not access a member of class com.matthewrathbone.example.SimpleUDFExample with modifiers ""

Upvotes: 3

Views: 2147

Answers (2)

Swapnil Godse
Swapnil Godse

Reputation: 19

I also had the same issue. It turned out, eclipse was not refreshing the program which i modified. So please make sure that the modifications you make in your code gets reflected in the jar.

Upvotes: 0

Sridhar
Sridhar

Reputation: 41

Declare the class as public, it should work

Upvotes: 4

Related Questions