title: HiveContext is not reading schema of an Orcfile
body: <p>When I run the following:</p>
  
  <pre><code>val df1 = sqlContext.read.format("orc").load(myPath)
  df1.columns.map(m =&gt; println(m))
  </code></pre>
  
  <p>The columns are printed as '_col0', '_col1', '_col2' etc. As opposed to their real names such as 'empno', 'name', 'deptno'.</p>
  
  <p>When I 'describe mytable' in Hive it prints the column name correctly, but when I run 'orcfiledump' it shows _col0, _col1, _col2 as well. Do I have to specify 'schema on read' or something? If yes, how do I do that in Spark/Scala?</p>
  
  <pre><code>hive --orcfiledump /apps/hive/warehouse/mydb.db/mytable1
  .....
  fieldNames: "_col0"
  fieldNames: "_col1"
  fieldNames: "_col2"
  </code></pre>
  
  <p>Note: I created the table as follows:</p>
  
  <pre><code>create table mydb.mytable1 (empno int, name VARCHAR(20), deptno int) stored as orc;
  </code></pre>
  
  <p>Note: This is not a duplicate of this issue (<a href="https://stackoverflow.com/questions/30094604/hadoop-orc-file-how-it-works-how-to-fetch-metadata">Hadoop ORC file - How it works - How to fetch metadata</a>) because the answer tells me to use 'Hive' &amp; I am already using HiveContext as follows:</p>
  
  <pre><code>val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)
  </code></pre>
  
  <p>By the way, I am using my own hive-site.xml, which contains following:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;property&gt;
        &lt;name&gt;hive.metastore.uris&lt;/name&gt;
        &lt;value&gt;thrift://sandbox.hortonworks.com:9083&lt;/value&gt;
      &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>