ulysses-you commented on a change in pull request #29034:
URL: https://github.com/apache/spark/pull/29034#discussion_r521758085



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
##########
@@ -863,7 +864,12 @@ case class ShowTablesCommand(
       // Show the information of tables.
       val tables =
         tableIdentifierPattern.map(catalog.listTables(db, 
_)).getOrElse(catalog.listTables(db))
-      tables.map { tableIdent =>
+      val filterCachedTables = if (showCached) {
+        tables.filter(table => 
sparkSession.catalog.isCached(table.quotedString))

Review comment:
       > I think SparkSession.table inside the isCached method will create a 
UnresolvedRelation with isStreaming = false, and later on in the analysis this 
flag may cause failure when a streaming table is encountered with that flag.
   
   I guess you consider about something like this ?
   ```
   
   def lookupTempView(
       identifier: Seq[String], isStreaming: Boolean = false): 
Option[LogicalPlan] = {
     // Permanent View can't refer to temp views, no need to lookup at all.
     if (isResolvingView) return None
   
     val tmpView = identifier match {
       case Seq(part1) => v1SessionCatalog.lookupTempView(part1)
       case Seq(part1, part2) => v1SessionCatalog.lookupGlobalTempView(part1, 
part2)
       case _ => None
     }
   
     if (isStreaming && tmpView.nonEmpty && !tmpView.get.isStreaming) {
       throw new AnalysisException(s"${identifier.quoted} is not a temp view of 
streaming " +
         s"logical plan, please use batch API such as `DataFrameReader.table` 
to read it.")
     }
     tmpView
   }
   ```




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to