scala - Cannot compile Spark Streaming example: getting updateStateByKey is not a member of org.apache.spark.streaming.dstream.DStream error -


i want understand spark streaming better copied statefulnetworkwordcount.scala example in own directory, , pasted as-is, created simple sbt config file, , tried compile doesnt seem work. why complaining api? idea? original example compile fine, want change it, without having compile whole spark directory set default.

thanks! matt

$ more build.sbt name := "simple project"  version := "1.0"  scalaversion := "2.10.4"  librarydependencies += "org.apache.spark" %% "spark-core" % "1.2.1" librarydependencies += "org.apache.spark" % "spark-streaming_2.10" % "1.2.1" urbanlegends-2:streamingtest mlieber$  

the error:

urbanlegends-2:streamingtest mlieber$sbt package [info] set current project simple project (in build file:/users/mlieber/app/spark2/spark/examples/lieber/streamingtest/) [info] compiling 2 scala sources /users/mlieber/app/spark2/spark/examples/lieber/streamingtest/target/scala-2.10/classes... [error] /users/mlieber/app/spark2/spark/examples/lieber/streamingtest/src/main/scala/com/cloudera/streamingtest/statefulnetworkwordcount2.scala:58: value updatestatebykey not member of org.apache.spark.streaming.dstream.dstream[(string, int)] [error]     **val statedstream = worddstream.updatestatebykey[int](newupdatefunc, [error]**                                    ^ [error] 1 error found [error] (compile:compile) compilation failed [error] total time: 3 s, completed mar 16, 2015 4:23:15 pm urbanlegends-2:streamingtest mlieber$  

looks problem in libraries version incapability. try replace "spark-core" % "1.2.1" , "spark-streaming_2.10" % "1.2.1" with

"spark-core" % "1.2.0"  "spark-streaming_2.10" % "1.2.0" 

[update] or need add import org.apache.spark.streaming.streamingcontext._


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

ios - Possible to get UIButton sizeThatFits to work? -