Twitter 齐柏林飞艇推特流媒体示例不起作用
我试图在齐柏林飞艇上运行Twitter流媒体示例。在四处搜索之后,我在spark解释器中添加了“org.apache.bahir:spark-streaming-twitter_2.11:2.0.0”。因此,我可以使第一部分工作,如: 现在,我尝试将下半部分添加为:Twitter 齐柏林飞艇推特流媒体示例不起作用,twitter,spark-streaming,apache-zeppelin,Twitter,Spark Streaming,Apache Zeppelin,我试图在齐柏林飞艇上运行Twitter流媒体示例。在四处搜索之后,我在spark解释器中添加了“org.apache.bahir:spark-streaming-twitter_2.11:2.0.0”。因此,我可以使第一部分工作,如: 现在,我尝试将下半部分添加为: case class Tweet(createdAt:Long, text:String, screenName:String) twt.map(status=> Tweet(status.getCreatedAt().
case class Tweet(createdAt:Long, text:String, screenName:String)
twt.map(status=>
Tweet(status.getCreatedAt().getTime()/1000, status.getText(), status.getUser().getScreenName())
).foreachRDD(rdd=>
rdd.toDF().registerTempTable("tweets")
)
现在我得到了一个错误:
<console>:56: error: not found: type StreamingContext
val ssc = new StreamingContext(sc, Seconds(2))
^
<console>:56: error: not found: value Seconds
val ssc = new StreamingContext(sc, Seconds(2))
^
<console>:61: error: not found: value Seconds
val twt = tweets.window(Seconds(60))
我也遇到了同样的问题,我不知道为什么在新StreamingContext修复它之前将导入语句从顶部向右移动,但它确实解决了这个问题
import org.apache.spark.streaming._ //moved here from top
import org.apache.spark.streaming.twitter._ //moved here from top
val ssc = new StreamingContext(sc, Seconds(2)) //existing
我也有类似的问题。使用FQCNs工作正常,因此我最终使用它作为解决方法
import org.apache.spark.streaming._ //moved here from top
import org.apache.spark.streaming.twitter._ //moved here from top
val ssc = new StreamingContext(sc, Seconds(2)) //existing