Repository: crunch
Updated Branches:
  refs/heads/master 71d59b691 -> cacb38377


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/cacb3837
Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/cacb3837
Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/cacb3837

Branch: refs/heads/master
Commit: cacb383778242c9cfb1590d0d3e0a446a80951e4
Parents: 71d59b6
Author: Josh Wills <[email protected]>
Authored: Fri Aug 1 15:23:34 2014 -0700
Committer: Josh Wills <[email protected]>
Committed: Fri Aug 1 15:23:34 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/cacb3837/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