如何使用 Hive Context 中的 Pyspark 调用用 Java 编写的 Hive UDF [英] How to call a hive UDF written in Java using Pyspark from Hive Context
本文介绍了如何使用 Hive Context 中的 Pyspark 调用用 Java 编写的 Hive UDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 hive 中使用 getLastProcessedVal2
UDF 从表中获取最新的分区.这个 UDF 是用 java 编写的.我想使用 hive 上下文使用来自 pyspark 的相同 UDF.
I use getLastProcessedVal2
UDF in hive to get the latest partitions from table. This UDF is written in java . I would like to use the same UDF from pyspark using hive context.
dfsql_sel_nxt_batch_id_ini=sqlContext.sql(''' select l4_xxxx_seee.**getLastProcessedVal2**("/data/l4/work/hive/l4__stge/proctl_stg","APP_AMLMKTE_L1","L1_AMLMKT_MDWE","TRE_EXTION","2.1")''')
错误:
错误 exec.FunctionRegistry:无法加载 UDF 类:java.lang.ClassNotFoundException:
ERROR exec.FunctionRegistry: Unable to load UDF class: java.lang.ClassNotFoundException:
推荐答案
启动你的 pyspark
shell:
start your pyspark
shell as:
pyspark --jars/path/to.udf.jar
或
使用 --jars
选项提交您的 pyspark 作业:
submit your pyspark job with --jars
option as:
spark-submit --jars/path/to/udf.jar
这篇关于如何使用 Hive Context 中的 Pyspark 调用用 Java 编写的 Hive UDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文