自定义hive的udf,统计表里面某个字段的emoji的个数。
eclipse编写hive udf需要添加两个包,hive-exec-1.1.0.jar和hadoop-core-0.20.2.jar
public class EmojiNum extends UDF {
//实现evaluate方法
public String evaluate(String string) throws Exception{
// public static void main(String[] argv) throws UnsupportedEncodingException
{
// String string="Thats a nice joke