无法通过 Jupyter 在没有错误的情况下导入 sqlContext.implicits._ [英] Can't import sqlContext.implicits._ without an error through Jupyter

查看:26
本文介绍了无法通过 Jupyter 在没有错误的情况下导入 sqlContext.implicits._的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I try to use the import sqlContext.implicits._ on my Jupyter notebook, I get the following error:

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

我已经在本地尝试过它并且可以正常工作,但是在我的 Jupyter Notebook 服务器(托管在 ec2 上)上使用它时无法正常工作.我曾尝试导入涉及该问题的不同库,但不幸的是无法使其正常运行.

I've tried this locally and it works, but this does not properly function when using it on my Jupyter Notebook server (which is hosted on ec2). I have tried importing different libraries involving that, but unfortunately can not get it to function.

推荐答案

你需要像这样实例化一个 sqlContext:

You need to instantiate a sqlContext like so:

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

您应该已经看到此错误:

You should have seen this error:

需要稳定的标识符

这篇关于无法通过 Jupyter 在没有错误的情况下导入 sqlContext.implicits._的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆