LantaoJin commented on a change in pull request #26466: [SPARK-29839][SQL] 
Supporting STORED AS in CREATE TABLE LIKE
URL: https://github.com/apache/spark/pull/26466#discussion_r350712006
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
 ##########
 @@ -88,20 +91,35 @@ case class CreateTableLikeCommand(
       sourceTableDesc.provider
     }
 
+    val newStorage = if (fileFormat.inputFormat.isDefined) {
+      sourceTableDesc.storage.copy(
 
 Review comment:
   @cloud-fan No. hive doesn't. But I am not sure it's a bug or on purpose. 
Here is the testing in Hive:
   ```shell
   hive> create table t1 (key int) ROW FORMAT SERDE 
'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ('a'='a') 
STORED AS TEXTFILE;;
   OK
   Time taken: 10.595 seconds
   
   hive> desc formatted t1;
   OK
   # col_name                   data_type               comment
   key                  string                  from deserializer
   
   # Detailed Table Information
   ...
   
   # Storage Information
   SerDe Library:       org.apache.hadoop.hive.serde2.OpenCSVSerde
   ...
   Storage Desc Params:
        a                       a
   Time taken: 0.152 seconds, Fetched: 29 row(s)
   
   hive> create table t2 like t1 ROW FORMAT SERDE 
'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ('b'='b');
   OK
   Time taken: 0.048 seconds
   hive> desc formatted t2;
   OK
   # col_name                   data_type               comment
   key                  string                  from deserializer
   
   # Detailed Table Information
   ...
   
   # Storage Information
   SerDe Library:       org.apache.hadoop.hive.serde2.OpenCSVSerde
   ...
   
   Storage Desc Params:
        a                       a
   Time taken: 0.062 seconds, Fetched: 31 row(s)
   ```

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