July 2017
Intermediate to advanced
796 pages
18h 55m
English
textFile() can be used to load textFiles into an RDD and each line becomes an element in the RDD.
sc.textFile(name, minPartitions=None, use_unicode=True)
The following is an example of loading a textfile into an RDD using textFile():
scala> val rdd_two = sc.textFile("wiki1.txt")rdd_two: org.apache.spark.rdd.RDD[String] = wiki1.txt MapPartitionsRDD[8] at textFile at <console>:24scala> rdd_two.countres6: Long = 9
Read now
Unlock full access