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_r269542092
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala
##########
@@ -193,6 +193,54 @@ class CachedTableSuite extends QueryTest with
SQLTestUtils with TestHiveSingleto
}
}
+ test("Refresh Qualified Tables") {
+ withTempDatabase { db =>
+ withTempView("cachedTable") {
+ try {
+ sql(s"CREATE TABLE $db.cachedTable STORED AS PARQUET AS SELECT 1")
+ sql(s"CACHE TABLE $db.cachedTable")
+ assertCached(sql(s"select * from $db.cachedTable"),
s"`$db`.`cachedTable`")
+ assert(spark.catalog.isCached(s"$db.cachedTable"), s"Table
'$db.cachedTable' should be cached")
+
+ sql(s"REFRESH TABLE $db.cachedTable")
+ assertCached(sql(s"select * from $db.cachedTable"),
s"`$db`.`cachedTable`")
+ assert(spark.catalog.isCached(s"$db.cachedTable"), s"Table
'$db.cachedTable' should be cached after refresh")
+
+ activateDatabase(db) {
+ assertCached(sql("select * from cachedTable"),
s"`$db`.`cachedTable`")
+ assert(spark.catalog.isCached("cachedTable"), "Table 'cachedTable'
should be cached after refresh")
+
+ sql(s"REFRESH TABLE cachedTable")
+ assertCached(sql("select * from cachedTable"),
s"`$db`.`cachedTable`")
+ assert(spark.catalog.isCached("cachedTable"), "Table 'cachedTable'
should be cached after refresh")
+ }
+ } finally {
+ sql(s"UNCACHE TABLE $db.cachedTable")
+ sql(s"DROP TABLE $db.cachedTable")
+ }
+
Review comment:
Nit: delete empty line
----------------------------------------------------------------
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]