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 2022/06/24 20:49:19 UTC

[GitHub] [spark] amaliujia commented on a diff in pull request #36983: [SPARK-39583] Make RefreshTable be compatible with 3 layer namespace

amaliujia commented on code in PR #36983:
URL: https://github.com/apache/spark/pull/36983#discussion_r906399415


##########
sql/core/src/test/scala/org/apache/spark/sql/internal/CatalogSuite.scala:
##########
@@ -749,4 +749,22 @@ class CatalogSuite extends SharedSparkSession with AnalysisTest with BeforeAndAf
     assert(spark.catalog.currentCatalog().equals("spark_catalog"))
     assert(spark.catalog.listCatalogs().collect().map(c => c.name).toSet == Set("testcat"))
   }
+
+  test("SPARK-39583: Make RefreshTable be compatible with 3 layer namespace") {
+    val catalogName = "testcat"
+    val dbName = "default"
+    val tableName = "my_table"
+    val tableSchema = new StructType().add("i", "int")
+    val description = "this is a test table"
+    val fullTableName = "testcat.default.my_table"
+
+    createTable(tableName, dbName, catalogName, classOf[FakeV2Provider].getName, tableSchema,
+      Map.empty[String, String], description)
+    spark.catalog.refreshTable(fullTableName)
+    assert(!spark.catalog.isCached(fullTableName))
+
+    spark.catalog.cacheTable(fullTableName)
+    spark.catalog.refreshTable(fullTableName)
+    assert(spark.catalog.isCached(fullTableName))

Review Comment:
   @cloud-fan what would be the best way to test `refreshTable`?
   
   
   I would imagine it is better to 
   1. cache the table and fetch the cached data into a local variable
   2. change the table
   3. refresh the table
   4. then compare current cached data from the result in 1.
   
   However I didn't find a good example for how to achieve above steps.
   
   



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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