如何使用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的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在蜂巢中使用getLastProcessedVal2
UDF从表中获取最新分区.此UDF用java编写.我想使用蜂巢上下文从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 <all-other-param>
OR
使用--jars
选项将您的pyspark作业提交为:
submit your pyspark job with --jars
option as:
spark-submit --jars /path/to/udf.jar <all-other-param>
这篇关于如何使用Hive Context中的Pyspark调用用Java编写的Hive UDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文