TomokoKomiyama edited a comment on issue #25848: [SPARK-29172][SQL] Fix some 
exception issue of explain commands
URL: https://github.com/apache/spark/pull/25848#issuecomment-535397067
 
 
   @srowen 
   If we use 'extend', sql behave like as follows even if we have error 
   ```
   scala> spark.sql("explain extended select * from hoge").show(false)
   
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |plan                                                                        
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              |
   
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |== Parsed Logical Plan ==
   'Project [*]
   +- 'UnresolvedRelation [hoge]
   
   == Analyzed Logical Plan ==
   org.apache.spark.sql.AnalysisException: Table or view not found: hoge; line 
1 pos 31;
   'Project [*]
   +- 'UnresolvedRelation [hoge]
   
   org.apache.spark.sql.AnalysisException: Table or view not found: hoge; line 
1 pos 31;
   'Project [*]
   +- 'UnresolvedRelation [hoge]
   
   == Optimized Logical Plan ==
   org.apache.spark.sql.AnalysisException: Table or view not found: hoge; line 
1 pos 31;
   'Project [*]
   +- 'UnresolvedRelation [hoge]
   
   == Physical Plan ==
   org.apache.spark.sql.AnalysisException: Table or view not found: hoge; line 
1 pos 31;
   'Project [*]
   +- 'UnresolvedRelation [hoge]
   |
   
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   ```
   , because of  the try exception in 
`sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala`(L156-)
   ```
       } catch {
         case e: AnalysisException => e.toString
       }
       append(analyzedOutput)
       append("\n")
       QueryPlan.append(analyzed, append, verbose, addSuffix, maxFields)
       append("\n== Optimized Logical Plan ==\n")
       QueryPlan.append(optimizedPlan, append, verbose, addSuffix, maxFields)
       append("\n== Physical Plan ==\n")
       QueryPlan.append(executedPlan, append, verbose, addSuffix, maxFields)
     }
   ```
   Other options such as cost, formated and codegen don't behave like this, so 
it needs something change to be consistent.
   I suggest that add try exceptions in other explain commands to make these 
behaviors like 'extend' one.

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