cloud-fan commented on a change in pull request #27984: [SPARK-31224][SQL] Add 
view support to SHOW CREATE TABLE
URL: https://github.com/apache/spark/pull/27984#discussion_r397697683
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
 ##########
 @@ -1109,21 +1138,37 @@ case class ShowCreateTableCommand(table: 
TableIdentifier)
           )
         }
 
-        if (tableMetadata.tableType == VIEW) {
-          throw new AnalysisException("Hive view isn't supported by SHOW 
CREATE TABLE")
-        }
-
         if 
("true".equalsIgnoreCase(tableMetadata.properties.getOrElse("transactional", 
"false"))) {
           throw new AnalysisException(
             "SHOW CREATE TABLE doesn't support transactional Hive table. " +
               s"Please use `SHOW CREATE TABLE ${tableMetadata.identifier} AS 
SERDE` " +
               "to show Hive DDL instead.")
         }
 
-        convertTableMetadata(tableMetadata)
+        if (tableMetadata.tableType == VIEW) {
+          tableMetadata
+        } else {
+          convertTableMetadata(tableMetadata)
+        }
       }
 
-      val stmt = showCreateDataSourceTable(metadata)
+      val builder = StringBuilder.newBuilder
+
+      val stmt = if (tableMetadata.tableType == VIEW) {
 
 Review comment:
   can we create a method to generate `CREATE VIEW`? So we can just call one 
method in the `if` branch.

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