Spark Hive UDF示例
建立项目
mvn clean package
将spark-hive-udf-1.0.0-SNAPSHOT.jar复制到边缘节点临时目录
spark-hive-udf]# cp target/spark-hive-udf-1.0.0-SNAPSHOT.jar /tmp
通过提供罐子来启动火花壳
spark-shell --master yarn --jars /tmp/spark-hive-udf-1.0.0-SNAPSHOT.jar
创建名称为大写的函数并列出该函数
spark.sql("CREATE OR REPLACE FUNCTION uppercase AS 'com.ranga.spark.hive.udf.UpperCaseUDF' USING JAR '/tmp/spark-hive-udf-1.0.0-SNAPSHOT.jar'")
sp
2022-03-30 20:00:16
5KB
Java
1