Quantcast
Channel: Hortonworks » All Replies
Viewing all articles
Browse latest Browse all 3435

Unable to instantiate UDF implementation class

$
0
0

I created the my first below udf and added to the hdp 2.2.4 sandbox.


package org.learn.hive;

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

class ToUpper extends UDF {

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

hive> add jar /root/revin/hive-to-upper-udf.jar;
Added [/root/revin/hive-to-upper-udf.jar] to class path
Added resources: [/root/revin/hive-to-upper-udf.jar]
hive> CREATE TEMPORARY FUNCTION toUpper as 'org.learn.hive.ToUpper';
OK
Time taken: 0.054 seconds

hive> select toUpper(description) from sample_07 limit 1;

I am getting the following error

<b>
FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments ‘description': Unable to instantiate UDF implementation class org.learn.hive.ToUpper: java.lang.IllegalAccessException: Class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge can not access a member of class org.learn.hive.ToUpper with modifiers “”
</b>

Any inputs will be appreciated. Thanks.


Viewing all articles
Browse latest Browse all 3435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>