My Spark/Scala job is processing data in a loop. I need to use the result of the previous loop to process information. I was caching the results, but the issue is that the spark plan for the cached DataFrame grows too large and my job errors out. While I have found a back up solution of writing to and reading from S3, it is time consuming. So, if there is a way to utilize the cache without growing the spark plan I would like to try it out. Or if there is another way to keep track of the computed data within the Spark program that would also help.