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 2019/03/27 12:43:31 UTC
[GitHub] [spark] attilapiros commented on a change in pull request #24221:
[SPARK-27248][SQL] refresh table should recreate cache with same cache name
attilapiros commented on a change in pull request #24221: [SPARK-27248][SQL] refresh table should recreate cache with same cache name
URL: https://github.com/apache/spark/pull/24221#discussion_r269541055
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
##########
@@ -205,6 +205,20 @@ abstract class QueryTest extends PlanTest {
planWithCaching)
}
+ /**
+ * Asserts that a given [[Dataset]] will be executed using the given named cache.
+ */
+ def assertCached(query: Dataset[_], cachedName: String): Unit = {
+ val planWithCaching = query.queryExecution.withCachedData
+ val cachedTableNames = planWithCaching collect {
+ case cached: InMemoryRelation => cached.cacheBuilder.tableName
Review comment:
The result type of the `tableName` is `Option[String]`:
https://github.com/apache/spark/blob/ca13fc4649a8ef59e12c73a50f4cda7f1980077f/sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/InMemoryRelation.scala#L46-L51
So the `collect` will produce `Seq[Option[String]]` and will contain tablenames as `Some[String]` so this assert will be raised always as `cachedName` is `String`:
https://github.com/apache/spark/blob/ca13fc4649a8ef59e12c73a50f4cda7f1980077f/sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala#L218
Is not 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
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org