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

 ##########
 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:
   I think you should investigate it by yourself.  I don't like the current 
approach too. Appeartly issue is minor but the fix is pretty invasive. I 
doesn't need to touch SessionStateBuilder side at all.

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


With regards,
Apache Git Services

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

Reply via email to