Skip to content

Instantly share code, notes, and snippets.

@thangarajan8
Created August 11, 2021 08:39
Show Gist options
  • Save thangarajan8/49a08a93b02ae05aaaf1e5aa3aadf2d6 to your computer and use it in GitHub Desktop.
Save thangarajan8/49a08a93b02ae05aaaf1e5aa3aadf2d6 to your computer and use it in GitHub Desktop.
lines = sc.textFile('data.txt') #reading a text file
lines_filtered = lines.filter(lambda line : ('word1' in line)) #filtering line contain the word "word1"
lines_filtered.first() #took 1s to run
lines_filtered.collect() #took 100s to run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment