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_r302000287
##########
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 This issue affect more aspect, what I point out in the jira is just
for the case "table or view not found", actually, this issue may cause many
other problems.
The root cause is that the the children of InsertIntoDataSourceDirCommand is
empty, thus many analysis rules after InsertIntoDataSourceDirCommand being
inserted(In DataSourceAnalysis rule) may not be effective.
I think we can fix it better inside InsertIntoDataSourceDirCommand, but I
should first make it clear that why we set it's children to empty, but use
innerChildren instead? Is there any PR or issue for that?
----------------------------------------------------------------
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]