Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
why this error
//package spark //import org.apache.spark.SparkConf //import _root_.kafka.serializer.DefaultDecoder //import _root_.kafka.serializer.StringDecoder //import org.apache.spark.streaming.kafka.KafkaUtils //import org.apache.spark.storage.StorageLevel //import org.apache.spark.streaming.StreamingContext //import org.apache.spark.streaming.Seconds //import org.apache.kafka.clients.consumer.ConsumerRecord //import org.apache.kafka.common.serialization.StringDeserializer //import org.apache.spark.streaming.kafka010._ //import org.apache.spark.streaming.kafka010.LocationStrategies.PreferConsistent //import org.apache.spark.streaming.kafka010.ConsumerStrategies.Subscribe //import org.apache.spark.SparkConf object WordCount { def main(args:Array[String]){ val sparkConf=new SparkConf().setAppName("KafkaWordCount").setMaster("local[2]") val ssc=new StreamingContext(sparkConf,Seconds(20)) val kafkaConf=Map( "zookeeper.connect" -> "localhost:2181", "group.id" -> "test-consumer-group", "zookeeper.connection.timeout.ms" ->"5000" ) val lines = KafkaUtils.createStream[Array[Byte],String,DefaultDecoder,DefaultDecoder] ( ssc, kafkaConf, Map("test" -> 1), StorageLevel.MEMORY_ONLY ) val words =lines.flatMap{case(x,y) => y.split("")} words.print() ssc.start() } }
run
|
edit
|
history
|
help
0
tail_recursion_scala
Scala sample program
JsonParser
SOF question https://stackoverflow.com/q/50428367/1198559 - Version 3
SUM TWO IN SCALA
Second world cup
Wallie
SOF question https://stackoverflow.com/q/50428367/1198559 - Version 3
SimpleGreeter
Sum of increment by 10%