scala - value registerAsTable is not a member of org.apache.spark.sql.DataFrame -
i running below code in zeppelin 0.7
%spark //val sc: sparkcontext // existing sparkcontext. sc import sqlcontext.implicits._ import org.apache.spark.sql._ import org.apache.spark.sql.dataframe; import org.apache.spark.sql.sqlcontext; val sqlcontext = new org.apache.spark.sql.sqlcontext(sc) val people = sqlcontext.jsonfile("/users/asdf/desktop/people.json") people.printschema() people.show() people.select("name").show() people.todf().registerastable("people")
its working till people.select("name").show()
throws error @ last line, below error:
+-------+ | name| +-------+ |michael| | andy| | justin| +-------+ <console>:230: error: value registerastable not member of org.apache.spark.sql.dataframe people.todf().registerastable("people")
asper knowledge imported required , converted df before registering table. missing here?
add following 2 lines after line "people.select("name").show()"
people.todf().createorreplacetempview("people") sqlcontext.sql("select * people").show()
though spark version displayed in spark-shell during startup can check version using below command.
sc.version
Comments
Post a Comment