JavaPaidRDD class creates instances of scala.math.Ordering<K>.
I've been able to view the code with Fernflower decompiler in IntelliJ IDEA.
For K=Integer, one can do:
"Ordering<Integer> ordering =
Ordering$.MODULE$.comparatorToOrdering(Comparator.<Integer>naturalOrder())"
or implement Comparator directly.
But beware... "Ordering$.MODULE$" is the static reference, and thus is not
Serializable.
So, the whole class performing calculation should implement Serializable.

I do have a working example of RDD.countByValue(Ordering<K>) in Java.

I'm guessing the creators of scala.math.* wanted those classes to be used in
Scala, not in Java (and Scala doesn't have static references).



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/How-to-use-scala-math-Ordering-in-java-tp26019p26218.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

Reply via email to