You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/14 08:29:56 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #31172: [SPARK-34099][SQL] Keep dependents of v2 tables cached during cache refreshing in DS v2 commands

MaxGekk commented on a change in pull request #31172:
URL: https://github.com/apache/spark/pull/31172#discussion_r557191146



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -60,21 +60,19 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
     session.sharedState.cacheManager.recacheByPlan(session, r)
   }
 
+  private def recacheTable(r: ResolvedTable)(): Unit = {
+    val v2Relation = DataSourceV2Relation.create(r.table, Some(r.catalog), Some(r.identifier))
+    session.sharedState.cacheManager.recacheByPlan(session, v2Relation)
+  }

Review comment:
       > If someone creates a method in cache manager to include three calls? :) I don't think the number of calls here is the point .
   
   Those 2 back-to-back calls:
   ```scala
       val cache = session.sharedState.cacheManager.lookupCachedData(v2Relation)
       session.sharedState.cacheManager.uncacheQuery(session, v2Relation, cascade = true)
   ```
   lead to unnecessary traversals over cache. In total 3 calls performs more work in the cache, I do believe. 
   
   > That's good, but please update the description too.
   
   I have updated it. Please, review it.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org