<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: pyspark  read file in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212760#M174696</link>
    <description>&lt;P&gt;looks like zeppelin issue and your coding is working great. Thanks a lot.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2018 22:45:25 GMT</pubDate>
    <dc:creator>ananthan_kathir</dc:creator>
    <dc:date>2018-10-17T22:45:25Z</dc:date>
    <item>
      <title>pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212752#M174688</link>
      <description>&lt;P&gt;Can we read the unix file using pyspark script using zeppelin?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 09:30:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212752#M174688</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-10-17T09:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212753#M174689</link>
      <description>&lt;P&gt;I would like read the contents of  unix file,  /path/example.txt&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 09:32:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212753#M174689</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-10-17T09:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212754#M174690</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/81211/ananthankathiramalai.html" nodeid="81211"&gt;@Anpan K&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Yes. you can read it like below&lt;/P&gt;&lt;PRE&gt;%pyspark
content = sc.textFile("file:///path/example.txt")&lt;/PRE&gt;&lt;P&gt;If file schema is not given,it defaults to HDFS&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 11:08:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212754#M174690</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2018-10-17T11:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212755#M174691</link>
      <description>&lt;P&gt;thank  you,  How do I read the contents?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 20:31:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212755#M174691</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-10-17T20:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212756#M174692</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/81211/ananthankathiramalai.html" nodeid="81211"&gt;@Anpan K&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;After you run the above snippet content is created as an RDD. You can perform operations on that RDD to whatever you want.&lt;/P&gt;&lt;P&gt;For ex:&lt;/P&gt;&lt;PRE&gt;%pyspark
content = sc.textFile("file:///path/example.txt")
content.collect()     -------&amp;gt; prints all lines
content.take(1) ----&amp;gt; prints 1 line
lines = content.map(lambda x: len(x)) ----&amp;gt; count no of character of each line
lines.take(5) ---&amp;gt; prints count of character of first 5 lines&lt;/PRE&gt;&lt;P&gt;Similarly you can perform other operations you want.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 20:42:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212756#M174692</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2018-10-17T20:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212757#M174693</link>
      <description>&lt;P&gt;thank you so much.&lt;/P&gt;&lt;P&gt;content = sc.textFile("file:///home/userid/test.txt")&lt;/P&gt;&lt;P&gt;Is it the right syntax or does it need to be pointed to HDFS only?&lt;/P&gt;&lt;P&gt;I am getting the following error message.&lt;/P&gt;&lt;P&gt;An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.
: org.apache.hadoop.mapred.InvalidInputException: Input path does not exist: file:/home/userid/test.txt
	at org.apache.hadoop.mapred.FileInputFormat.singleThreadedListStatus(FileInputFormat.java:287)
	at org.apache.hadoop.mapred.FileInputFormat.listStatus(FileInputFormat.java:229)
	at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java:315)
	at org.apache.spark.rdd.HadoopRDD.getPartitions(HadoopRDD.scala:199)
	at org.apache.spark.rdd.RDD$anonfun$partitions$2.apply(RDD.scala:252)
	at org.apache.spark.rdd.RDD$anonfun$partitions$2.apply(RDD.scala:250)
	at scala.Option.getOrElse(Option.scala:121)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:250)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$anonfun$partitions$2.apply(RDD.scala:252)
	at org.apache.spark.rdd.RDD$anonfun$partitions$2.apply(RDD.scala:250)
	at scala.Option.getOrElse(Option.scala:121)&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 20:49:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212757#M174693</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-10-17T20:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212758#M174694</link>
      <description>&lt;P&gt;Can you try&lt;/P&gt;&lt;PRE&gt;content = sc.textFile("file:/home/userid/test.txt")&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 20:57:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212758#M174694</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2018-10-17T20:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212759#M174695</link>
      <description>&lt;P&gt;thaks a lot.  It works through command line shell. not working through zeppelin&lt;/P&gt;&lt;PRE&gt;content = sc.textFile("file:///path/example.txt")&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 21:00:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212759#M174695</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-10-17T21:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: pyspark  read file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212760#M174696</link>
      <description>&lt;P&gt;looks like zeppelin issue and your coding is working great. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 22:45:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/pyspark-read-file/m-p/212760#M174696</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-10-17T22:45:25Z</dc:date>
    </item>
  </channel>
</rss>

