使用 spark-csv 在 zeppelin 中读取 csv 文件 [英] Reading csv files in zeppelin using spark-csv
问题描述
我想在 Zeppelin 中读取 csv 文件并想使用 databricks'spark-csv 包:https://github.com/databricks/spark-csv
I wanna read csv files in Zeppelin and would like to use databricks' spark-csv package: https://github.com/databricks/spark-csv
在 spark-shell 中,我可以将 spark-csv 与
In the spark-shell, I can use spark-csv with
spark-shell --packages com.databricks:spark-csv_2.11:1.2.0
但是我如何告诉 Zeppelin 使用该软件包?
But how do I tell Zeppelin to use that package?
提前致谢!
推荐答案
您需要先将 Spark Packages 存储库添加到 Zeppelin,然后才能在 spark 包上使用 %dep.
You need to add the Spark Packages repository to Zeppelin before you can use %dep on spark packages.
%dep
z.reset()
z.addRepo("Spark Packages Repo").url("http://dl.bintray.com/spark-packages/maven")
z.load("com.databricks:spark-csv_2.10:1.2.0")
或者,如果这是您希望在所有笔记本中都可用的内容,您可以在 Zeppelin 的解释器配置中的 spark-submit 命令设置中添加 --packages 选项,然后重新启动解释器.这应该根据 spark-shell 方法使用已经加载的包启动上下文.
Alternatively, if this is something you want available in all your notebooks, you can add the --packages option to the spark-submit command setting in the interpreters config in Zeppelin, and then restart the interpreter. This should start a context with the package already loaded as per the spark-shell method.
这篇关于使用 spark-csv 在 zeppelin 中读取 csv 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!