You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@crunch.apache.org by ki...@apache.org on 2012/10/09 21:47:10 UTC

git commit: CRUNCH-86. Conversions between Java and Scala maps are not active in Scrunch.

Updated Branches:
  refs/heads/master 7fef772cf -> 255800fb3


CRUNCH-86. Conversions between Java and Scala maps are not active in Scrunch.


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

Branch: refs/heads/master
Commit: 255800fb35701657c66057a30c288f320f5e2dac
Parents: 7fef772
Author: Kiyan Ahmadizadeh <ki...@wibidata.com>
Authored: Thu Oct 4 00:43:34 2012 -0700
Committer: Kiyan Ahmadizadeh <ki...@wibidata.com>
Committed: Tue Oct 9 12:09:53 2012 -0700

----------------------------------------------------------------------
 .../org/apache/crunch/scrunch/Conversions.scala    |    8 ++++++++
 .../org/apache/crunch/scrunch/PTypeFamily.scala    |    3 ++-
 2 files changed, 10 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/255800fb/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Conversions.scala
----------------------------------------------------------------------
diff --git a/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Conversions.scala b/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Conversions.scala
index bbb7946..a6b8893 100644
--- a/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Conversions.scala
+++ b/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/Conversions.scala
@@ -97,6 +97,14 @@ object PTypeH {
     }
   }
 
+  implicit def maps[T: PTypeH] = {
+    new PTypeH[Map[String, T]] {
+      def get(ptf: PTypeFamily) = {
+        ptf.maps(implicitly[PTypeH[T]].get(ptf))
+      }
+    }
+  }
+
   implicit def pairs[A: PTypeH, B: PTypeH] = {
     new PTypeH[(A, B)] {
       def get(ptf: PTypeFamily) = {

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/255800fb/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/PTypeFamily.scala
----------------------------------------------------------------------
diff --git a/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/PTypeFamily.scala b/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/PTypeFamily.scala
index 65ac8b8..40f2070 100644
--- a/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/PTypeFamily.scala
+++ b/crunch-scrunch/src/main/scala/org/apache/crunch/scrunch/PTypeFamily.scala
@@ -78,7 +78,8 @@ trait PTypeFamily {
   }
 
   def maps[T](ptype: PType[T]) = {
-    derived(classOf[scala.collection.Map[String, T]], mapAsScalaMap[String, T], mapAsJavaMap[String, T], ptf.maps(ptype))
+    derived(classOf[Map[String, T]], {x: java.util.Map[String, T] => mapAsScalaMap(x).toMap}, 
+        mapAsJavaMap[String, T], ptf.maps(ptype))
   }
 
   def lists[T](ptype: PType[T]) = {