title: How to read gz compressed file by pyspark
body: <p>I have line data in .gz compressed format. I have to read it in pyspark
  Following is the code snippet</p>
  
  <pre><code>rdd = sc.textFile("data/label.gz").map(func)
  </code></pre>
  
  <p>But I could not read the above file successfully. How do I read gz compressed file. I have found a similar question <a href="https://stackoverflow.com/questions/38256631/why-are-my-binaryfiles-empty-when-i-collect-them-in-pyspark">here</a> but my current version of spark is different that the version in that question. I expect there should be some built in function as in hadoop.</p>