forked from d2iq-archive/tweeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tweeter-analytics.json
1 lines (1 loc) · 5.74 KB
/
tweeter-analytics.json
1
{"paragraphs":[{"title":"Load Dependencies","text":"%dep\nz.load(\"org.apache.commons:commons-csv:1.2\")\nz.load(\"org.apache.spark:spark-streaming-kafka_2.10:1.5.2\")\nz.load(\"com.typesafe.play:play-json_2.10:2.4.6\")\n","dateUpdated":"Apr 18, 2016 6:43:09 PM","config":{"colWidth":12,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true,"editorMode":"ace/mode/scala","title":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1461004989264_383768947","id":"20160418-184309_508939537","result":{"code":"SUCCESS","type":"TEXT","msg":"res0: org.apache.zeppelin.spark.dep.Dependency = org.apache.zeppelin.spark.dep.Dependency@5ba40793\n"},"dateCreated":"Apr 18, 2016 6:43:09 PM","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:20"},{"title":"Spark Streaming","text":"import java.text.{SimpleDateFormat, ParseException}\nimport java.util.Date\n\nimport org.apache.spark.{SparkConf}\nimport org.apache.spark.streaming.kafka.{KafkaUtils}\nimport org.apache.spark.streaming.{StreamingContext, Seconds}\n\nimport play.api.libs.json._\n\nval ssc = new StreamingContext(sc, Seconds(2))\nval msgStream = KafkaUtils.createStream(ssc, \"master.mesos:2181/dcos-service-kafka\", \"zeppelin-consumer-group\", Map(\"tweets\" -> 1)).map(_._2)\n\nval tweetStream = msgStream.map(tweetString => {\n val tweet = Json.parse(tweetString)\n ((tweet \\ \"handle\").as[String], (tweet \\ \"content\").as[String], (tweet \\ \"created_at\").as[String])\n })\ntweetStream.print()\n \ntweetStream.window(Seconds(60))\n .foreachRDD(rdd => rdd.toDF(\"handle\", \"content\", \"created_at\").registerTempTable(\"tweets\"))\n \n \n \nssc.start()","dateUpdated":"Apr 18, 2016 6:44:03 PM","config":{"colWidth":12,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true,"tableHide":false,"editorMode":"ace/mode/scala","title":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1461004989265_383384198","id":"20160418-184309_1078829498","result":{"code":"SUCCESS","type":"TEXT","msg":"import java.text.{SimpleDateFormat, ParseException}\nimport java.util.Date\nimport org.apache.spark.SparkConf\nimport org.apache.spark.streaming.kafka.KafkaUtils\nimport org.apache.spark.streaming.{StreamingContext, Seconds}\nimport play.api.libs.json._\nssc: org.apache.spark.streaming.StreamingContext = org.apache.spark.streaming.StreamingContext@33126f3f\nmsgStream: org.apache.spark.streaming.dstream.DStream[String] = org.apache.spark.streaming.dstream.MappedDStream@1f5376fc\ntweetStream: org.apache.spark.streaming.dstream.DStream[(String, String, String)] = org.apache.spark.streaming.dstream.MappedDStream@20f4af29\n"},"dateCreated":"Apr 18, 2016 6:43:09 PM","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:21"},{"title":"Top tweeters","text":"%sql select handle, count(*) as count from tweets\n group by handle\n order by count desc","dateUpdated":"Apr 18, 2016 6:43:09 PM","config":{"colWidth":12,"graph":{"mode":"multiBarChart","height":560,"optionOpen":false,"keys":[{"name":"handle","index":0,"aggr":"sum"}],"values":[{"name":"count","index":1,"aggr":"sum"}],"groups":[],"scatter":{"xAxis":{"name":"handle","index":0,"aggr":"sum"}}},"enabled":true,"editorMode":"ace/mode/sql","editorHide":false,"tableHide":false,"title":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1461004989265_384538445","id":"20160418-184309_1093666837","result":{"code":"SUCCESS","type":"TABLE","msg":"handle\tcount\nrosalind\t236\ntouchstone\t134\njaques\t117\ncelia\t97\norlando\t94\nduke senior\t48\ncorin\t42\nphebe\t30\nduke frederick\t19\namiens\t17\nsilvius\t15\naudrey\t9\nsir oliver martext\t7\nadam\t2\noliver\t2\n","comment":"","msgTable":[[{"key":"count","value":"rosalind"},{"key":"count","value":"236"}],[{"value":"touchstone"},{"value":"134"}],[{"value":"jaques"},{"value":"117"}],[{"value":"celia"},{"value":"97"}],[{"value":"orlando"},{"value":"94"}],[{"value":"duke senior"},{"value":"48"}],[{"value":"corin"},{"value":"42"}],[{"value":"phebe"},{"value":"30"}],[{"value":"duke frederick"},{"value":"19"}],[{"value":"amiens"},{"value":"17"}],[{"value":"silvius"},{"value":"15"}],[{"value":"audrey"},{"value":"9"}],[{"value":"sir oliver martext"},{"value":"7"}],[{"value":"adam"},{"value":"2"}],[{"value":"oliver"},{"value":"2"}]],"columnNames":[{"name":"handle","index":0,"aggr":"sum"},{"name":"count","index":1,"aggr":"sum"}],"rows":[["rosalind","236"],["touchstone","134"],["jaques","117"],["celia","97"],["orlando","94"],["duke senior","48"],["corin","42"],["phebe","30"],["duke frederick","19"],["amiens","17"],["silvius","15"],["audrey","9"],["sir oliver martext","7"],["adam","2"],["oliver","2"]]},"dateCreated":"Apr 18, 2016 6:43:09 PM","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:22"},{"dateUpdated":"Apr 18, 2016 6:43:09 PM","config":{"colWidth":12,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true,"editorMode":"ace/mode/scala"},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1461004989266_384538445","id":"20160418-184309_1977340255","result":{"code":"SUCCESS","type":"TEXT"},"dateCreated":"Apr 18, 2016 6:43:09 PM","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:23"}],"name":"Tweeter Analytics","id":"2BGEB4WMQ","angularObjects":{"2BFVURX7P":[],"2BJ26CJUP":[],"2BGC7K1CY":[],"2BGG4QMZP":[],"2BHTSMVYX":[],"2BJAXRYGW":[],"2BH1XZMES":[],"2BJ3XKTDP":[],"2BHEWU631":[],"2BJ9J1UR6":[],"2BG18JECV":[],"2BGYEW4KP":[],"2BGTRC1KJ":[],"2BHPKYBCN":[]},"config":{"looknfeel":"default"},"info":{}}