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

查看:53
本文介绍了无法通过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:

需要稳定的标识符

stable identifier required

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

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