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/27 05:50:54 UTC

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

cloud-fan commented on code in PR #36983:
URL: https://github.com/apache/spark/pull/36983#discussion_r906997789


##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -647,15 +647,15 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
    * @since 2.0.0
    */
   override def refreshTable(tableName: String): Unit = {
-    val tableIdent = sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
-    val relation = sparkSession.table(tableIdent).queryExecution.analyzed
+    val relation = sparkSession.table(tableName).queryExecution.analyzed
 
     relation.refresh()
 
+    val ident = sparkSession.sessionState.sqlParser.parseMultipartIdentifier(tableName)
     // Temporary and global temporary views are not supposed to be put into the relation cache
     // since they are tracked separately.
-    if (!sessionCatalog.isTempView(tableIdent)) {
-      sessionCatalog.invalidateCachedTable(tableIdent)
+    if (!sessionCatalog.isTempView(ident)) {
+      sessionCatalog.invalidateCachedTable(makeTableIdentifier(ident))

Review Comment:
   we should use `executePlan(RefreshTable).assertCommandExecuted`



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