liupc commented on a change in pull request #25019: [SPARK-28195][SQL] Fix 
CheckAnalysis not working for InsertIntoDataSourceDirCommand and report 
misleading error message
URL: https://github.com/apache/spark/pull/25019#discussion_r300530794
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/internal/BaseSessionStateBuilder.scala
 ##########
 @@ -188,6 +189,15 @@ abstract class BaseSessionStateBuilder(
         customCheckRules
 
     override protected def lookupCatalog(name: String): CatalogPlugin = 
session.catalog(name)
+
+    override def checkAnalysis(plan: LogicalPlan): Unit = {
+      // We should check it's innerChildren for InsertIntoDataSourceDirCommand
+      val planToCheck = plan match {
+        case e: InsertIntoDataSourceDirCommand => e.query
+        case _ => plan
+      }
+      super.checkAnalysis(planToCheck)
 
 Review comment:
   @maropu  Yes, I agree that resolving this issue inside 
`InsertIntoDataSourceDirCommand` is better, but as I have already questioned is 
the jira: https://issues.apache.org/jira/browse/SPARK-28195, I'm not sure 
whether there are some special consideration for making the children of 
`InsertIntoDataSourceDirCommand` to empty and use innerChildren instead.

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


With regards,
Apache Git Services

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

Reply via email to