cloud-fan commented on a change in pull request #30079:
URL: https://github.com/apache/spark/pull/30079#discussion_r509947710



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/v2ResolutionPlans.scala
##########
@@ -45,12 +45,25 @@ case class UnresolvedTable(multipartIdentifier: 
Seq[String]) extends LeafNode {
 /**
  * Holds the name of a table or view that has yet to be looked up in a 
catalog. It will
  * be resolved to [[ResolvedTable]] or [[ResolvedView]] during analysis.
+ *
+ * If 'isResolutionRequired' is set to false and the name cannot be resolved 
to a table or view,
+ * [[UnresolvedTableOrView]] will be converted to [[NotFoundTableOrView]].
  */
-case class UnresolvedTableOrView(multipartIdentifier: Seq[String]) extends 
LeafNode {
+case class UnresolvedTableOrView(
+    multipartIdentifier: Seq[String],
+    isResolutionRequired: Boolean = true) extends LeafNode {
   override lazy val resolved: Boolean = false
   override def output: Seq[Attribute] = Nil
 }
 
+/**
+ * Holds the name of a table or view that has been looked up in a catalog, but 
not found.
+ * This is a "resolved" logical.
+ */
+case class NotFoundTableOrView(multipartIdentifier: Seq[String]) extends 
LeafNode {

Review comment:
       If this is specific to DROP TABLE, let's avoid changing the framework. 
How about we add a rule in the `Post-Hoc Resolution` batch in the analyzer:
   ```
   object ResolveNoopDropTable extends Rule[LogicalPlan] {
     def apply(plan: LogicalPlan) = plan.transform {
        case DropTable(_: UnresolvedTableOrView, _, true) => NoopDropTable
     }
   }
   ```
   where `NoopDropTable` is a new command that does nothing but only keeping 
the table name for EXPLAIN.




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