scala - Zeppelin SqlContext registerTempTable issue -
i trying access json data using sqlcontext.jsonfile in zeppelin...
following code execute without error:
import sys.process._ val sqlcon = new org.apache.spark.sql.sqlcontext(sc) val jfile = sqlcon.jsonfile(s"file:///usr/local/src/knoldus/projects/scaladay_data/scaladays2015amsterdam_tweets.json") import sqlcontext.implicits._ jfile.registertemptable("jtable01")
output :
import sys.process._ sqlcon: org.apache.spark.sql.sqlcontext = org.apache.spark.sql.sqlcontext@7034473 jfile: org.apache.spark.sql.dataframe = [id: struct, content: string, hashtags: array, score: struct, session: string, timestamp: bigint, tweetid: bigint, username: string] import sqlcontext.implicits.
next verify table name registered
sqlcon.tablenames().foreach(println)
output :
jtable01
but when try run following error:
%sql select * jtable01
output :
no such table jtable01; line 1 pos 14
at same time when run tutorial example "bank" works.... difference make out in bank tutorial using sc.textfile in case wanted use sqlcontext.jsonfile.
could please provide guidance how can fix issue?
found solution removed
val sqlcon = new org.apache.spark.sql.sqlcontext(sc)
from code , used zeppelin default sqlcontext , works!!!
Comments
Post a Comment