title: How to create a partitioned table using Spark SQL
body: <p>I know we can create a auto partition discovery table via</p>
  
  <pre><code>CREATE TABLE my_table
  USING com.databricks.spark.avro
  OPTIONS (path "/path/to/table");
  </code></pre>
  
  <p>But this requires change the data path to <strong>partition_key=partition_value</strong> format</p>
  
  <pre><code>/path/to/table/dt=2016-10-09
  /path/to/table/dt=2016-10-10
  /path/to/table/dt=2016-10-11
  </code></pre>
  
  <p>But the data structure looks like:</p>
  
  <pre><code>/path/to/table/2016-10-09
  /path/to/table/2016-10-10
  /path/to/table/2016-10-11
  </code></pre>
  
  <p>I don't want to change existing data structure, so I am trying to do it like Hive way, which I just create a partition table, then I can add these partitions by myself, so I don't need to change existing data structure to <strong>partition_key=partition_value</strong> format.</p>
  
  <p>But the SQL below didn't work:</p>
  
  <pre><code>CREATE TABLE my_table
  USING com.databricks.spark.avro
  PARTITIONED BY (dt)
  OPTIONS (path "/path/to/table");
  </code></pre>
  
  <p>The SQL command line tool will throw exception: <code>Error in query: cannot recognize input near 'thrive_event_pt' 'USING' 'com' in table name; line 2 pos 0</code></p>
  
  <p>Does Spark SQL support to create a partitioned table in this way? or there is something else I am missing?</p>