You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Chirag Dewan <ch...@ericsson.com> on 2015/09/04 11:10:03 UTC

Output files of saveAsText are getting stuck in temporary directory

Hi,

I have a 2 node Spark cluster and I am trying to read data from a Cassandra cluster and save the data as CSV file. Here is my code:

JavaRDD<String> mapPair = cachedRdd.map(new Function<CassandraRow, String>() {

                                                /**
                                                *
                                                 */
                                                private static final long serialVersionUID = 1L;

                                                @Override
                                                public String call(CassandraRow v1) throws Exception {

                                                                StringBuilder sb = new StringBuilder();
                                                                sb.append(v1.getString(0));
                                                                sb.append(",");
                                                                sb.append(v1.getBytes(1));
                                                                sb.append(",");
                                                                sb.append(v1.getString(2));
                                                                sb.append(",");
                                                                sb.append(v1.getString(3));
                                                                sb.append(",");
                                                                sb.append(v1.getString(4));
                                                                sb.append(",");
                                                                sb.append(v1.getString(5));
                                                                return sb.toString();
                                                }
                                });

JavaRDD<String> cachedRdd1 = mapPair.cache();

                JavaRDD<String> coalescedRdd = cachedRdd1.coalesce(1);
                coalescedRdd.saveAsTextFile("file:///home/echidew/cassandra/test-100.txt");

                context.stop();

The problem is that part-00000 file is created with all the records in the _temporary/task-UUID folder. As I have read and understood this file should be stored at my output path and the temporary directory is deleted. Anything I need to change in my code or environment? What could be the reason for that?

Any help appreciated.

P.S : Posting only the relevant code. Sorry for the formatting.

Thanks,

Chirag

RE: Output files of saveAsText are getting stuck in temporary directory

Posted by Chirag Dewan <ch...@ericsson.com>.
Hi,

Any idea about this? I am still facing this issue.

thanks,

Chirag

-----Original Message-----
From: Chirag Dewan [mailto:chirag.dewan@ericsson.com] 
Sent: Friday, September 04, 2015 3:26 PM
To: Sean Owen
Cc: user@spark.apache.org
Subject: RE: Output files of saveAsText are getting stuck in temporary directory

Yes. The driver has successfully stopped. All the shutdown is succeeded without any errors in logs. 

I am using spark 1.4.1 with Cassandra 2.0.14.

Chirag

-----Original Message-----
From: Sean Owen [mailto:sowen@cloudera.com]
Sent: Friday, September 04, 2015 3:23 PM
To: Chirag Dewan
Cc: user@spark.apache.org
Subject: Re: Output files of saveAsText are getting stuck in temporary directory

That means the save has not finished yet. Are you sure it did? it writes in _temporary while it's in progress

On Fri, Sep 4, 2015 at 10:10 AM, Chirag Dewan <ch...@ericsson.com> wrote:
> Hi,
>
>
>
> I have a 2 node Spark cluster and I am trying to read data from a 
> Cassandra cluster and save the data as CSV file. Here is my code:
>
>
>
> JavaRDD<String> mapPair = cachedRdd.map(new Function<CassandraRow,
> String>() {
>
>
>
>                                                 /**
>
>                                                 *
>
>                                                  */
>
>                                                 private static final 
> long serialVersionUID = 1L;
>
>
>
>                                                 @Override
>
>                                                 public String 
> call(CassandraRow v1) throws Exception {
>
>
>
>
> StringBuilder sb = new StringBuilder();
>
>
> sb.append(v1.getString(0));
>
>
> sb.append(",");
>
>
> sb.append(v1.getBytes(1));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(2));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(3));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(4));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(5));
>
>                                                                 return 
> sb.toString();
>
>                                                 }
>
>                                 });
>
>
>
> JavaRDD<String> cachedRdd1 = mapPair.cache();
>
>
>
>                 JavaRDD<String> coalescedRdd = cachedRdd1.coalesce(1);
>
>
> coalescedRdd.saveAsTextFile("file:///home/echidew/cassandra/test-100.t
> xt");
>
>
>
>                 context.stop();
>
>
>
> The problem is that part-00000 file is created with all the records in 
> the _temporary/task-UUID folder. As I have read and understood this 
> file should be stored at my output path and the temporary directory is 
> deleted. Anything I need to change in my code or environment? What 
> could be the reason for that?
>
>
>
> Any help appreciated.
>
>
>
> P.S : Posting only the relevant code. Sorry for the formatting.
>
>
>
> Thanks,
>
>
>
> Chirag

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


RE: Output files of saveAsText are getting stuck in temporary directory

Posted by Chirag Dewan <ch...@ericsson.com>.
Yes. The driver has successfully stopped. All the shutdown is succeeded without any errors in logs. 

I am using spark 1.4.1 with Cassandra 2.0.14.

Chirag

-----Original Message-----
From: Sean Owen [mailto:sowen@cloudera.com] 
Sent: Friday, September 04, 2015 3:23 PM
To: Chirag Dewan
Cc: user@spark.apache.org
Subject: Re: Output files of saveAsText are getting stuck in temporary directory

That means the save has not finished yet. Are you sure it did? it writes in _temporary while it's in progress

On Fri, Sep 4, 2015 at 10:10 AM, Chirag Dewan <ch...@ericsson.com> wrote:
> Hi,
>
>
>
> I have a 2 node Spark cluster and I am trying to read data from a 
> Cassandra cluster and save the data as CSV file. Here is my code:
>
>
>
> JavaRDD<String> mapPair = cachedRdd.map(new Function<CassandraRow, 
> String>() {
>
>
>
>                                                 /**
>
>                                                 *
>
>                                                  */
>
>                                                 private static final 
> long serialVersionUID = 1L;
>
>
>
>                                                 @Override
>
>                                                 public String 
> call(CassandraRow v1) throws Exception {
>
>
>
>
> StringBuilder sb = new StringBuilder();
>
>
> sb.append(v1.getString(0));
>
>
> sb.append(",");
>
>
> sb.append(v1.getBytes(1));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(2));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(3));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(4));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(5));
>
>                                                                 return 
> sb.toString();
>
>                                                 }
>
>                                 });
>
>
>
> JavaRDD<String> cachedRdd1 = mapPair.cache();
>
>
>
>                 JavaRDD<String> coalescedRdd = cachedRdd1.coalesce(1);
>
>
> coalescedRdd.saveAsTextFile("file:///home/echidew/cassandra/test-100.t
> xt");
>
>
>
>                 context.stop();
>
>
>
> The problem is that part-00000 file is created with all the records in 
> the _temporary/task-UUID folder. As I have read and understood this 
> file should be stored at my output path and the temporary directory is 
> deleted. Anything I need to change in my code or environment? What 
> could be the reason for that?
>
>
>
> Any help appreciated.
>
>
>
> P.S : Posting only the relevant code. Sorry for the formatting.
>
>
>
> Thanks,
>
>
>
> Chirag

Re: Output files of saveAsText are getting stuck in temporary directory

Posted by Sean Owen <so...@cloudera.com>.
That means the save has not finished yet. Are you sure it did? it
writes in _temporary while it's in progress

On Fri, Sep 4, 2015 at 10:10 AM, Chirag Dewan <ch...@ericsson.com> wrote:
> Hi,
>
>
>
> I have a 2 node Spark cluster and I am trying to read data from a Cassandra
> cluster and save the data as CSV file. Here is my code:
>
>
>
> JavaRDD<String> mapPair = cachedRdd.map(new Function<CassandraRow, String>()
> {
>
>
>
>                                                 /**
>
>                                                 *
>
>                                                  */
>
>                                                 private static final long
> serialVersionUID = 1L;
>
>
>
>                                                 @Override
>
>                                                 public String
> call(CassandraRow v1) throws Exception {
>
>
>
>
> StringBuilder sb = new StringBuilder();
>
>
> sb.append(v1.getString(0));
>
>
> sb.append(",");
>
>
> sb.append(v1.getBytes(1));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(2));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(3));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(4));
>
>
> sb.append(",");
>
>
> sb.append(v1.getString(5));
>
>                                                                 return
> sb.toString();
>
>                                                 }
>
>                                 });
>
>
>
> JavaRDD<String> cachedRdd1 = mapPair.cache();
>
>
>
>                 JavaRDD<String> coalescedRdd = cachedRdd1.coalesce(1);
>
>
> coalescedRdd.saveAsTextFile("file:///home/echidew/cassandra/test-100.txt");
>
>
>
>                 context.stop();
>
>
>
> The problem is that part-00000 file is created with all the records in the
> _temporary/task-UUID folder. As I have read and understood this file should
> be stored at my output path and the temporary directory is deleted. Anything
> I need to change in my code or environment? What could be the reason for
> that?
>
>
>
> Any help appreciated.
>
>
>
> P.S : Posting only the relevant code. Sorry for the formatting.
>
>
>
> Thanks,
>
>
>
> Chirag

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org