Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import sqlContext.implicits._ without an error through Jupyter

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._
                         ^

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.

like image 249
Eric Staner Avatar asked Feb 06 '23 19:02

Eric Staner


2 Answers

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

like image 154
Emre Avatar answered Apr 19 '23 22:04

Emre


you have to use val keyword instead of var keyword. Since val is equals to const or final keywords.

like image 24
Varadha31590 Avatar answered Apr 20 '23 00:04

Varadha31590