title: How to transform a txt file into a parquet file and load it into a hdfs table-pyspark
body: <p>I have a text file that I am trying to convert to a parquet file and then load it into a hive table by write it to it's hdfs path. Everything runs but the table shows no values.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#Create my table
  spark.sql("create  external table if not exists table1 ( c0 string, c1 string, c2 string)  STORED AS parquet LOCATION 'hdfs://hadoop_data/hive/table1'")
  
  hdfs="hdfs://hadoop_data/hive/table1/output.parquet"
  
  #Read my data file
  e=spark.read.text("/home/path/sample_txt_files/sample5.txt")
  
  #Write it to hdfs table as a parquet file
  e.write.parquet("hdfs")
  </code></pre>
  
  <p>Everything runs but when I check the contents of the table by select * from table1, no values are there:</p>
  
  <p><a href="https://i.stack.imgur.com/RjL1g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RjL1g.png" alt="txt fi"></a></p>
  
  <p>The content in the sample5.txt file goes like this:</p>
  
  <pre><code>ID,Name,Age
  1,James,15
  </code></pre>
  
  <p>Content inside the .parqeut file
  <a href="https://i.stack.imgur.com/90dzh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/90dzh.png" alt="enter image description here"></a></p>
  
  <p>Any ideas or suggestion as to why no data is showing in the table?</p>