How to get datatype of a column in spark SQL?
<p>I want to find out the datatype of each column of a table?</p>

<p>For example, let's say my table was created using this:</p>

<pre><code>create table X
(
col1 string,
col2 int,
col3 int
)
</code></pre>

<p>I want to do a command that will output somethign like this:</p>

<pre><code>column datatype
col1  string
col2  int
</code></pre>

<p>Is there a command for this?  Preferably in SparkSQL. But, if not, then how to get this data using another way?   I'm using spark sql to query hive tables.  Perhaps through the metadata in HIVE?  thank you. </p>