Repository: crunch
Updated Branches:
  refs/heads/apache-crunch-0.8 522734f19 -> 81b5701c9


CRUNCH-451: Fix error messages for Scrunch's ReverseJoinStrategy


Project: http://git-wip-us.apache.org/repos/asf/crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/crunch/commit/81b5701c
Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/81b5701c
Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/81b5701c

Branch: refs/heads/apache-crunch-0.8
Commit: 81b5701c92bf15c561f10e447babf805ae990851
Parents: 522734f
Author: Josh Wills <[email protected]>
Authored: Fri Aug 1 15:23:34 2014 -0700
Committer: Josh Wills <[email protected]>
Committed: Fri Aug 1 16:07:26 2014 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/crunch/scrunch/Joins.scala      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/crunch/blob/81b5701c/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Joins.scala
----------------------------------------------------------------------
diff --git 
a/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Joins.scala 
b/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Joins.scala
index c6b7d62..9a7b6d6 100644
--- a/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Joins.scala
+++ b/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Joins.scala
@@ -43,7 +43,7 @@ class ScrunchJoinStrategy[K, U, V](val delegate: 
JoinStrategy[K, U, V]) {
 
 private class ReverseJoinStrategy[K, U, V](val delegate: JoinStrategy[K, V, 
U]) extends JoinStrategy[K, U, V] {
   override def join(left: crunch.PTable[K, U], right: crunch.PTable[K, V], 
joinType: JoinType) = {
-    val res: crunch.PTable[K, P[V, U]] =
+    val res: crunch.PTable[K, P[V, U]] = try {
       if (joinType == JoinType.LEFT_OUTER_JOIN) {
         delegate.join(right, left, JoinType.RIGHT_OUTER_JOIN)
       } else if (joinType == JoinType.RIGHT_OUTER_JOIN) {
@@ -51,6 +51,11 @@ private class ReverseJoinStrategy[K, U, V](val delegate: 
JoinStrategy[K, V, U])
       } else {
         delegate.join(right, left, joinType)
       }
+    }
+    catch {
+      case uoe: UnsupportedOperationException => throw new 
UnsupportedOperationException(
+        "Join type " + joinType + " not supported by " + 
delegate.getClass.getName)
+    }
     res.mapValues(new SwapFn[V, U](), SwapFn.ptype(res.getValueType))
   }
 }

Reply via email to