SHARE
TWEET

Untitled

a guest Jun 20th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from pyspark import SparkContext
  2. from pyspark.streaming import StreamingContext
  3.  
  4. sc = SparkContext.getOrCreate()
  5. ssc = StreamingContext(sc, 1)
  6.  
  7. stream_data = ssc.textFileStream("file:///tmp/stream") \
  8.     .map( lambda x: x.split(","))
  9.  
  10. stream_data.pprint()
  11.  
  12. ssc.start()
  13.  
  14. ssc.awaitTermination()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top