title: How to identify the partition columns in hive table using Spark SQL
body: <p>I am trying to identify the partition Column names in a hive table using Spark .I am able to do that using show partitions followed by parsing the resultset to extract the partition columns .However , the drawback is , if some of the tales do not have a partition in them , the show partition fails .Is there a more organic way to identify the partition column names in a hive table.
  Any help would be highly appreciated</p>
  
  <pre><code>v_query="show partitions {}".format(table_name)
  a=self.spark.sql(v_query)
  val=a.rdd.map(list).first()
  val1=''.join(val)
  partition_list=[l.split('=')[0] for l in val1.split('/')]
  </code></pre>