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 01:48:18 UTC

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

ulysses-you commented on code in PR #36983:
URL: https://github.com/apache/spark/pull/36983#discussion_r906912293


##########
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:
   TableCatalog has its own `invalidateTable` so it seems we can not only do it with session catalog. An option may be: construct a `RefreshTable` and call `sessionState.executePlan(RefreshTable)`, so the analyzer can decide use which catalog, i.e. session catalog or other catalog.



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