I am new to hive's udf. I have downloaded "apache-hive-2.1.0-bin
" and configured build path of my project to apache-hive-2.1.0-bin\lib
(all jars).
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text; // <= I am not able to import this package.
public class replace extends UDF {
private Text result = new Text();
public Text evaluate(String str, String str1, String str2) {
String rep = str.replace(str1, str2);
result.set(rep);
return result;
}
}
add the following in lib path hadoop-common-2.2.0.jar
It will be available in
http://central.maven.org/maven2/org/apache/hadoop/hadoop-common/2.2.0/hadoop-common-2.2.0.jar