问题
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.
回答1:
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
回答2:
you have to use val
keyword instead of var
keyword. Since val
is equals to const
or final
keywords.
来源:https://stackoverflow.com/questions/37798657/cant-import-sqlcontext-implicits-without-an-error-through-jupyter