From 84757c4e29727518231a84a6b12cdbcca0f11a2c Mon Sep 17 00:00:00 2001 From: Tom Dyas Date: Wed, 5 Aug 2015 11:54:10 -0400 Subject: [PATCH] add .groupWith method to TypedPipe This method is more convenient than trying to pass the Ordering[K] explicitly into the .group method because there is no need to also specify the evidence parameter proving that the TypedPipe[T] is a TypedPipe[(K, V)]. --- .../src/main/scala/com/twitter/scalding/typed/TypedPipe.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scalding-core/src/main/scala/com/twitter/scalding/typed/TypedPipe.scala b/scalding-core/src/main/scala/com/twitter/scalding/typed/TypedPipe.scala index cff2ed36e5..c5286d0d7c 100644 --- a/scalding-core/src/main/scala/com/twitter/scalding/typed/TypedPipe.scala +++ b/scalding-core/src/main/scala/com/twitter/scalding/typed/TypedPipe.scala @@ -388,6 +388,9 @@ trait TypedPipe[+T] extends Serializable { def groupBy[K](g: T => K)(implicit ord: Ordering[K]): Grouped[K, T] = map { t => (g(t), t) }.group + /** Group using an explicit Ordering on the key. */ + def groupWith[K, V](ord: Ordering[K])(implicit ev: <:<[T, (K, V)]): Grouped[K, V] = group(ev, ord) + /** * Forces a shuffle by randomly assigning each item into one * of the partitions.