gpt4 book ai didi

scala - 无法通过 Jupyter 导入 sqlContext.implicits._ 而不会出现错误

转载 作者:行者123 更新时间:2023-12-03 02:24:53 26 4
gpt4 key购买 nike

当我尝试在 Jupyter 笔记本上使用 import sqlContext.implicits._ 时,出现以下错误:

Name: Compile Error
Message: <console>:25: error: stable identifier required, but $iwC.this.$VAL10.sqlContext.implicits found.
import sqlContext.implicits._
^

我已经在本地尝试过这个方法并且它可以工作,但是当在我的 Jupyter Notebook 服务器(托管在 ec2 上)上使用它时,它无法正常工作。我尝试过导入涉及此的不同库,但不幸的是无法使其发挥作用。

最佳答案

您需要像这样实例化 sqlContext:

val sqlC = new org.apache.spark.sql.SQLContext(sc)
import sqlC.implicits._

您应该看到此错误:

stable identifier required

关于scala - 无法通过 Jupyter 导入 sqlContext.implicits._ 而不会出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37798657/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com