liupc opened a new pull request #25019: [SPARK-28195]Fix CheckAnalysis not 
working for command and report misleading error message
URL: https://github.com/apache/spark/pull/25019
 
 
   
   ## What changes were proposed in this pull request?
   
   This PR will try to fix the issue that the sub plan of command is not being 
checked for analysis and sometimes will report misleading error message.
   An example sql is like 
   `insert overwrite directory '/path' using parquet select * from table1`
   
   When "table1" does not exists, we will finally got a misleading error 
message:
   ```
   Caused by: org.apache.spark.sql.catalyst.analysis.UnresolvedException: 
Invalid call to dataType on unresolved object, tree: 'kr.objective_id
   at 
org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.dataType(unresolved.scala:105)
   at 
org.apache.spark.sql.types.StructType$$anonfun$fromAttributes$1.apply(StructType.scala:440)
   at 
org.apache.spark.sql.types.StructType$$anonfun$fromAttributes$1.apply(StructType.scala:440)
   at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
   at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
   at scala.collection.immutable.List.foreach(List.scala:381)
   at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
   at scala.collection.immutable.List.map(List.scala:285)
   at 
org.apache.spark.sql.types.StructType$.fromAttributes(StructType.scala:440)
   at 
org.apache.spark.sql.catalyst.plans.QueryPlan.schema$lzycompute(QueryPlan.scala:159)
   at org.apache.spark.sql.catalyst.plans.QueryPlan.schema(QueryPlan.scala:159)
   at 
org.apache.spark.sql.execution.datasources.DataSource.planForWriting(DataSource.scala:544)
   at 
org.apache.spark.sql.execution.command.InsertIntoDataSourceDirCommand.run(InsertIntoDataSourceDirCommand.scala:70)
   at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
   at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
   at 
org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:79)
   at 
org.apache.spark.sql.execution.adaptive.QueryStage.executeCollect(QueryStage.scala:246)
   at org.apache.spark.sql.Dataset$$anonfun$6.apply(Dataset.scala:190)
   at org.apache.spark.sql.Dataset$$anonfun$6.apply(Dataset.scala:190)
   at org.apache.spark.sql.Dataset$$anonfun$52.apply(Dataset.scala:3277)
   at 
org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:77)
   at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3276)
   at org.apache.spark.sql.Dataset.<init>(Dataset.scala:190)
   at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:75)
   at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:642)
   at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:694)
   at 
org.apache.spark.sql.hive.thriftserver.SparkExecuteStatementOperation.org$apache$spark$sql$hive$thriftserver$SparkExecuteStatementOperation$$execute(SparkExecuteStatementOperation.scala:277)
   ... 11 more
   ```
   
   ## How was this patch tested?
   
   exist UT(AnalysisSuite)
   

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