Details
Description
We can reproduce by below commands:
beeline> create or replace temporary view temp1 as select 1 beeline> cache table temp1 beeline> create or replace temporary view temp1 as select 1, 2 beeline> cache table temp1
The cached RDD for plan "select 1" stays in memory forever until the session close. This cached data cannot be used since the view temp1 has been replaced by another plan. It's a memory leak.
assert(spark.sharedState.cacheManager.lookupCachedData(sql("select 1, 2")).isDefined)
assert(spark.sharedState.cacheManager.lookupCachedData(sql("select 1")).isDefined)