> On Oct 20, 2015, at 5:31 PM, ravi.gawai <ravi.ga...@gmail.com> wrote:
> 
> you can use mapfunction..
> 
> This is java example.. 
> 
> final JavaRDD<Product> rdd1 = sc.textFile("filepath").map((line) -> {
> //logic for line to product converstion});
> 
> Product class might have 5 attributes like you said class Product{
> String str1;
> int i1;
> String str2;
> int i2;
> String str3;
> // with getter setters
> }
> Now you can convert this Product RDD to another CustomRDD lets say Class
> SubProduct{ String str1;int i1; //getter setters }
> 
>     final JavaRDD<SubProduct> rdd2 = rdd1.map(product -> {
>                final SubProduct subProduct = new SubProduct();
> 
>                // map product attributes to subProduct attributes;
>                return subProduct;
>            });
> 
> 
> 
> 
> --
> View this message in context: 
> http://apache-spark-user-list.1001560.n3.nabble.com/Filter-RDD-tp25133p25148.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
> For additional commands, e-mail: user-h...@spark.apache.org
> 

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

Reply via email to