创建上下文后,将jar文件添加到pyspark [英] Adding a jar file to pyspark after context is created
问题描述
我正在使用笔记本中的pyspark而我没有处理SparkSession的创建。
我需要在处理我的rdds时加载一个包含我想要使用的函数的jar。这是你可以很容易地使用--jars在我的特定情况下无法做到的事情。
有没有办法访问spark scala上下文并调用addJar方法?我试图使用JavaGateway(sparksession._jvm ...)但到目前为止还没有成功。有什么想法?
I am using pyspark from a notebook and I do not handle the creation of the SparkSession. I need to load a jar containing some functions I would like to use while processing my rdds. This is something which you can easily do using --jars which I cannot do in my particular case. Is there a way to access the spark scala context and call the addJar method? I tried to use the JavaGateway (sparksession._jvm...) but have not been successful so far. Any idea?
谢谢
Guillaume
Thanks Guillaume
推荐答案
sparksession ._jsc.addJar完成了这项工作。
sparksession._jsc.addJar does the job.
这篇关于创建上下文后,将jar文件添加到pyspark的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!