生活随笔
收集整理的这篇文章主要介绍了
hive udf
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
流程
写java打jar包add jar filePath(可本地,可hdfs)create temporary function xxx as “your class”
import org
.apache
.hadoop
.hive
.ql
.exec
.UDF
;
import org
.apache
.hadoop
.io
.Text
;
public class UDFTest extents UDF
{public Text
evaluate(Text input
){return new Text("hello:" + input
.toString());}
}
<properties><hadoop.version>2.6.0
</hadoop.version><hive.version>1.1.0
</hive.version></properties><dependencies><dependency><groupId>org.apache.hadoop
</groupId><artifactId>hadoop-common
</artifactId><version>${hadoop.version}
</version></dependency><dependency><groupId>org.apache.hive
</groupId><artifactId>hive-exec
</artifactId><version>${hive.version}
</version></dependency><dependency><groupId>junit
</groupId><artifactId>junit
</artifactId><version>4.12
</version></dependency></dependencies>
UDF种类
function用法
| UDF | |
| genericUDF | |
| UDAF | 多进一出 |
| UDTF | 一进多出 |
Reference
https://blog.csdn.net/Gavin_chun/article/details/78169317
https://blog.csdn.net/qq_34319644/article/details/95668820
总结
以上是生活随笔为你收集整理的hive udf的全部内容,希望文章能够帮你解决所遇到的问题。
如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。