March 2018
Beginner to intermediate
394 pages
10h 57m
English
One of the powerful features of spark is building applications that process real-time streaming data and produce real-time results. In order to understand this more, we will write a simple application that tries to find duplicate messages in an input stream and prints all the unique messages.
This kind of application is helpful when we are dealing with an unreliable stream of data and we want to submit only the data that is unique.
The source code for this application is given here:
[hive@node-3 ~]$ cat StreamingDedup.py from pyspark import SparkContext from pyspark.streaming import StreamingContext context = SparkContext(appName="StreamingDedup") stream = StreamingContext(context, 5) records = stream.socketTextStream("localhost", ...Read now
Unlock full access