Question: What happens when you run the following code? import sys from pyspark import SparkContext if _ _ name _ _ = = _ _

What happens when you run the following code?
import sys
from pyspark import SparkContext
if __name__=="__main__":
sc = SparkContext(appName="PythonWordCount")
lines = sc.textFile(sys.argv[1],1)
counts = lines.flatMap(lambda x: x.split('')).map(lambda x: (x,1))
* Consider that the sys.argv[1] is the correct path address of a very large Text file.
A.
It will do nothing. Spark will evaluate the code and realize that there is no action defined that will trigger the execution of the defined RDD transformations so that it will run no operation.
B.
It will split a text file into words and count the words.
C.
It will split the text file into lines and then count lines only.
D.
It will split the text file into words and count the words in the background but do nothing because there is no printout.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!