avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1190636 - in /avro/trunk: CHANGES.txt lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java
Date Fri, 28 Oct 2011 22:24:14 GMT
Author: cutting
Date: Fri Oct 28 22:24:14 2011
New Revision: 1190636

URL: http://svn.apache.org/viewvc?rev=1190636&view=rev
Log:
AVRO-944. Java: Fix mapred so that reduce-side combines use correct serializer.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1190636&r1=1190635&r2=1190636&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Fri Oct 28 22:24:14 2011
@@ -231,6 +231,9 @@ Avro 1.6.0 (27 October 2011)
     AVRO-948. Java: Fix to more correctly handle Thrift optional and
     nullable fields.  (cutting)
 
+    AVRO-944. Java: Fix mapred so that reduce-side combines use
+    correct serializer. (cutting)
+
 Avro 1.5.4 (12 September 2011)
 
   IMPROVEMENTS

Modified: avro/trunk/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java?rev=1190636&r1=1190635&r2=1190636&view=diff
==============================================================================
--- avro/trunk/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java
(original)
+++ avro/trunk/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java
Fri Oct 28 22:24:14 2011
@@ -49,9 +49,6 @@ public class AvroSerialization<T> extend
   /** Returns the specified map output deserializer.  Defaults to the final
    * output deserializer if no map output schema was specified. */
   public Deserializer<AvroWrapper<T>> getDeserializer(Class<AvroWrapper<T>>
c) {
-    //  We need not rely on mapred.task.is.map here to determine whether map
-    //  output or final output is desired, since the mapreduce framework never
-    //  creates a deserializer for final output, only for map output.
     boolean isKey = AvroKey.class.isAssignableFrom(c);
     Schema schema = isKey
       ? Pair.getKeySchema(AvroJob.getMapOutputSchema(getConf()))
@@ -100,10 +97,9 @@ public class AvroSerialization<T> extend
   
   /** Returns the specified output serializer. */
   public Serializer<AvroWrapper<T>> getSerializer(Class<AvroWrapper<T>>
c) {
-    // Here we must rely on mapred.task.is.map to tell whether the map output
-    // or final output is needed.
-    boolean isMap = getConf().getBoolean("mapred.task.is.map", false);
-    Schema schema = !isMap
+    // AvroWrapper used for final output, AvroKey or AvroValue for map output
+    boolean isFinalOutput = c.equals(AvroWrapper.class);
+    Schema schema = isFinalOutput
       ? AvroJob.getOutputSchema(getConf())
       : (AvroKey.class.isAssignableFrom(c)
          ? Pair.getKeySchema(AvroJob.getMapOutputSchema(getConf()))



Mime
View raw message