I would suggest you take alook to DataFrames. Also, I do not think you
should implement comparators for user class as a whole, rather you should
get the attribute to sort/compar on and delete sorting to data type of
inherent attribute. Eg. sorting can be done by name and if so, it should be
string sorting. In that case, you can create another KeyValue RDD whr key
is the "chosen" attribute and value is user object and do a sortByKey.

On Tue, Jul 7, 2015 at 10:09 PM, Hafsa Asif <hafsa.a...@matchinguu.com>
wrote:

> I have also tried this stupid code snippet, only thinking that it may even
> compile code
> Function1<User, Object> FILTER_USER = new AbstractFunction1<User, Object
> >()
> {
>         public Object apply(User user){
>             return user;
>         }
>     };
>
>
> FILTER_USER is fine but cannot be applied to the following two options but
> no results:
>                 User[] filterUsr =
> (User[])rdd.rdd().retag(User.class).filter(FILTER_USER);
>
>                 User userFilter = (User) rdd.rdd().filter(FILTER_USER);
>
> Giving issue: Inconertable types
> I really need proper code related to this issue.
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/How-to-implement-top-and-filter-on-object-List-for-JavaRDD-tp23669p23677.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
>
>


-- 
Best Regards,
Ayan Guha

Reply via email to