imback82 commented on a change in pull request #30079:
URL: https://github.com/apache/spark/pull/30079#discussion_r513034303



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -368,9 +368,13 @@ class ResolveSessionCatalog(
           orCreate = c.orCreate)
       }
 
+    case DropTable(
+        r @ ResolvedTable(_, _, _: V1Table), ifExists, purge) if 
isSessionCatalog(r.catalog) =>
+      DropTableCommand(r.identifier.asTableIdentifier, ifExists, isView = 
false, purge = purge)
+
     // v1 DROP TABLE supports temp view.
-    case DropTableStatement(TempViewOrV1Table(name), ifExists, purge) =>
-      DropTableCommand(name.asTableIdentifier, ifExists, isView = false, purge 
= purge)
+    case DropTable(r: ResolvedView, ifExists, purge) =>

Review comment:
       If we put the assert here, the output call stack doesn't seem to be very 
helpful to the user:
   ```
   java.lang.AssertionError: assertion failed
        at scala.Predef$.assert(Predef.scala:208)
        at 
org.apache.spark.sql.catalyst.analysis.ResolveSessionCatalog$$anonfun$apply$1.applyOrElse(ResolveSessionCatalog.scala:376)
        at 
org.apache.spark.sql.catalyst.analysis.ResolveSessionCatalog$$anonfun$apply$1.applyOrElse(ResolveSessionCatalog.scala:47)
        at 
org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.$anonfun$resolveOperatorsUp$3(AnalysisHelper.scala:90)
        at 
org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:74)
   ```
   , also there is an existing test around it: 
   
https://github.com/apache/spark/blob/3f2a2b5fe6ada37ef86f00737387e6cf2496df74/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala#L1057
   
   I am throwing an exception instead similar to how `DropTableCommand` is 
handling. Please let me know what you think about this.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to