LantaoJin opened a new pull request #27185: [SPARK-30494][SQL] Avoid duplicated 
cached RDD when create or replace an existing view
URL: https://github.com/apache/spark/pull/27185
 
 
   ### What changes were proposed in this pull request?
   
   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.
   
   We can reproduce by below commands:
   ```
   beeline> create or replace temporary view temp1 as select 1
   beeline> cache table tempView
   beeline> create or replace temporary view temp1 as select 1, 2
   beeline> cache table tempView
   ```
   
   assert(spark.sharedState.cacheManager.lookupCachedData(sql("select 1, 
2")).isDefined)
   assert(spark.sharedState.cacheManager.lookupCachedData(sql("select 
1")).isDefined)
   
   
   ### Why are the changes needed?
   Fix the memory leak, specially for long running mode. 
   
   
   ### Does this PR introduce any user-facing change?
   No.
   
   
   ### How was this patch tested?
   Add an unit test.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to