You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Chen Jin <ka...@gmail.com> on 2014/01/03 07:02:27 UTC

a question about "take"

Hi, 

I just started to fiddle with Spark a week ago. I am trying to understand take function more. I have a JavaRDD<T> variable, let’s say dataSet which is initialized by getSequenceFileAsRDD, when I try dataSet.take(1), it throughs an error as follows:

java.lang.IllegalStateException: Must not use direct buffers with
InputStream

But when I add add the following lines before the take call: 

        dataSet.context().setCheckpointDir("/tmp/checkpoint/", true);
        dataSet.checkpoint();
        dataSet.saveAsTextFile("/tmp/backup.txt”);

	dataSet.take(1);

Then take() works. I am confused here by how RDD's take method. Can anybody help me explain why this happens?

Thanks a lot,

-cj