You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Xingwei Yang <ha...@gmail.com> on 2014/12/06 00:51:09 UTC

Transfer from RDD to JavaRDD

I use Spark in Java.

I want to access the vectors of RowMatrix M, thus I use M.rows(), which is
a RDD<Vector>

I want to transform it to JavaRDD<Vector>, I used the following command;

 JavaRDD<Vector> data = JavaRDD.fromRDD(M.rows(),
scala.reflect.ClassTag$.MODULE$.apply(Vector.class);

However, it shows a error like this:

The method fromRDD(RDD<T>, ClassTag<T>) in the type JavaRDD is not
applicable for the arguments (RDD<Vector>, ClassTag<Object>)

Is there anything wrong with the method? Thanks a lot.


-- 
Sincerely Yours
Xingwei Yang
https://sites.google.com/site/xingweiyang1223/

Re: Transfer from RDD to JavaRDD

Posted by Sean Owen <so...@cloudera.com>.
You can probably get around it with casting, but I ended up using
wrapRDD -- which is not a static method -- from another JavaRDD in
scope to address this more directly without casting or warnings. It's
not ideal but both should work, just a matter of which you think is
less hacky.

On Fri, Dec 5, 2014 at 5:51 PM, Xingwei Yang <ha...@gmail.com> wrote:
> I use Spark in Java.
>
> I want to access the vectors of RowMatrix M, thus I use M.rows(), which is a
> RDD<Vector>
>
> I want to transform it to JavaRDD<Vector>, I used the following command;
>
>  JavaRDD<Vector> data = JavaRDD.fromRDD(M.rows(),
> scala.reflect.ClassTag$.MODULE$.apply(Vector.class);
>
> However, it shows a error like this:
>
> The method fromRDD(RDD<T>, ClassTag<T>) in the type JavaRDD is not
> applicable for the arguments (RDD<Vector>, ClassTag<Object>)
>
> Is there anything wrong with the method? Thanks a lot.
>
>
> --
> Sincerely Yours
> Xingwei Yang
> https://sites.google.com/site/xingweiyang1223/
>

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