January 2019
Beginner to intermediate
154 pages
4h 31m
English
The life cycle of the cached RDD will end when the Spark session ends. If you have computed an RDD and you want it to use in another Spark program without recomputing it, then you can make use of the checkpoint() operation. This allows storing the RDD content on the disk, which can be used for the later operations. Let's discuss this with the help of an example:
#PythonbaseRDD = spark.sparkContext.parallelize(['A','B','C'])spark.sparkContext.setCheckpointDir("/FileStore/tables/checkpointing")baseRDD.checkpoint()
We first create a baseRDD and set a checkpointing directory using setCheckpointDir() method. Finally, we store the content of baseRDD using checkpoint().
Read now
Unlock full access