You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by DataNut <ro...@fmr.com> on 2014/12/09 00:49:59 UTC
Error outputing to CSV file
I am trying to create a CSV file, I have managed to create the actual string
I want to output to a file, but when I try to write the file, I get the
following error.
/saveAsTextFile is not a member of String/
My string is perfect, when I call this line to actually save the file, I get
the above error.
/val csv = fields.map(_.mkString("|")).mkString("\n")
csv.saveAsSequenceFile("/tmp/mytext")/
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Error-outputing-to-CSV-file-tp20583.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
Re: Error outputing to CSV file
Posted by manasdebashiskar <ma...@gmail.com>.
saveAsSequenceFile method works on rdd. your object csv is a String.
If you are using spark-shell you can type your object to know it's datatype.
Some prefer eclipse(and it's intelli) to make their live easier.
..Manas
-----
Manas Kar
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Error-outputing-to-CSV-file-tp20583p20615.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
Re: Error outputing to CSV file
Posted by Muhammad Ahsan <mu...@gmail.com>.
Hi
saveAsTextFile is a member of RDD where as
fields.map(_.mkString("|")).mkString("\n") is a string. You have to
transform it into RDD using something like sc.parallel(...) before
saveAsTextFile.
Thanks
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Error-outputing-to-CSV-file-tp20583p20629.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org