incubator-crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gr...@apache.org
Subject git commit: [CRUNCH-38] Fix deep copying for true primitives
Date Sat, 11 Aug 2012 09:27:55 GMT
Updated Branches:
  refs/heads/master 5588544c7 -> 03dd4b52b


[CRUNCH-38] Fix deep copying for true primitives

Extra fix for side-effect of CRUNCH-38 -- getting detached values
for true primitives (i.e. int) was broken.


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

Branch: refs/heads/master
Commit: 03dd4b52b164b3540fbaba38c198c0160a479734
Parents: 5588544
Author: Gabriel Reid <gabriel.reid@gmail.com>
Authored: Sat Aug 11 11:25:17 2012 +0200
Committer: Gabriel Reid <gabriel.reid@gmail.com>
Committed: Sat Aug 11 11:25:17 2012 +0200

----------------------------------------------------------------------
 .../java/org/apache/crunch/types/avro/Avros.java   |    2 +-
 .../org/apache/crunch/types/avro/AvrosTest.java    |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/03dd4b52/crunch/src/main/java/org/apache/crunch/types/avro/Avros.java
----------------------------------------------------------------------
diff --git a/crunch/src/main/java/org/apache/crunch/types/avro/Avros.java b/crunch/src/main/java/org/apache/crunch/types/avro/Avros.java
index a6d7169..1fd7baa 100644
--- a/crunch/src/main/java/org/apache/crunch/types/avro/Avros.java
+++ b/crunch/src/main/java/org/apache/crunch/types/avro/Avros.java
@@ -137,7 +137,7 @@ public class Avros {
   }
 
   static <T> boolean isPrimitive(AvroType<T> avroType) {
-    return PRIMITIVES.containsKey(avroType.getTypeClass());
+    return avroType.getTypeClass().isPrimitive() || PRIMITIVES.containsKey(avroType.getTypeClass());
   }
 
   private static <T> AvroType<T> create(Class<T> clazz, Schema.Type schemaType)
{

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/03dd4b52/crunch/src/test/java/org/apache/crunch/types/avro/AvrosTest.java
----------------------------------------------------------------------
diff --git a/crunch/src/test/java/org/apache/crunch/types/avro/AvrosTest.java b/crunch/src/test/java/org/apache/crunch/types/avro/AvrosTest.java
index 5946096..082ddec 100644
--- a/crunch/src/test/java/org/apache/crunch/types/avro/AvrosTest.java
+++ b/crunch/src/test/java/org/apache/crunch/types/avro/AvrosTest.java
@@ -216,9 +216,15 @@ public class AvrosTest {
   }
 
   @Test
-  public void testIsPrimitive_True() {
+  public void testIsPrimitive_PrimitiveMappedType() {
     assertTrue(Avros.isPrimitive(Avros.ints()));
   }
+  
+  @Test
+  public void testIsPrimitive_TruePrimitiveValue(){
+    AvroType truePrimitiveAvroType = new AvroType(int.class, Schema.create(Type.INT));
+    assertTrue(Avros.isPrimitive(truePrimitiveAvroType));
+  }
 
   @Test
   public void testIsPrimitive_False() {


Mime
View raw message