title: How to get the value of the location for a Hive table using a Spark object?
body: <p>I am interested in being able to retrieve the <strong>location</strong> value of a Hive table given a Spark object (SparkSession). One way to obtain this value is by parsing the output of the location via the following SQL query:</p>
  
  <pre><code>describe formatted &lt;table name&gt;
  </code></pre>
  
  <p>I was wondering if there is another way to obtain the <strong>location</strong> value without having to parse the output. An API would be great in case the output of the above command changes between Hive versions. If an external dependency is needed, which would it be? Is there some sample spark code that can obtain the location value?</p>