Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5014#discussion_r26630953
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
    @@ -585,34 +589,6 @@ private[hive] class HiveMetastoreCatalog(hive: 
HiveContext) extends Catalog with
             }
     
           case p: LogicalPlan if p.resolved => p
    -
    -      case p @ CreateTableAsSelect(db, tableName, child, allowExisting, 
None) =>
    --- End diff --
    
    `CreateTableAsSelect` was designed to support CTAS, not only for HiveQL, 
but also for the other SQL dialect. See: 
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala#L128,
 the type of `desc` is `desc:Option[T]`
    In HiveQL case, the `T` should be `ASTNode`, and `desc` will never be 
`None`, we can always extract the `SerDe` information from it via Hive 
`SemanticAnalyzer`, even if no storage spec specified in the DDL SQL, as Hive 
`SemanticAnalyzer` will give the default `SerDe` for that case, So seems 
`hasStorageSpec` will be false only if the table already existed?
    
    The change @viirya made seems reasonable for me here, the only concern is 
what if `hive.convertCTAS` is false and no storage spec specified in DDL SQL? 
How to extract the default serde (as the `desc` is None)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to