Github user gatorsmile commented on the pull request:

    https://github.com/apache/spark/pull/13395
  
    Just realized you are working on all the restrictions of CTAS. Based on the 
[official document of 
Hive](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTableAsSelect(CTAS)),
 CTAS has three restrictions:
    - The target table cannot be a partitioned table.
    - The target table cannot be an external table.
    - The target table cannot be a list bucketing table.
    
    I have two test cases you can put in `DDLCommandSuite`:
    ```scala
      test("CTAS - PARTITIONED BY is not supported") {
        assertUnsupported(
          sql = "CREATE TABLE my_tab(a double, b double) PARTITIONED BY (a 
STRING) " +
            "AS SELECT key, value FROM mytable1")
      }
    
      test("CTAS - Bucketing is not supported") {
        assertUnsupported(
          sql = "CREATE TABLE my_tab(a double, b double) " +
            "CLUSTERED BY (a) SORTED BY (b) INTO 5 BUCKETS AS SELECT key, value 
FROM mytable1")
      }
    ```


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