生活随笔
收集整理的這篇文章主要介紹了
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的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。