accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1208603 - in /incubator/accumulo/trunk: ./ src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/ src/core/src/test/java/org/apache/accumulo/core/iterators/user/
Date Wed, 30 Nov 2011 18:09:28 GMT
Author: billie
Date: Wed Nov 30 18:09:27 2011
New Revision: 1208603

URL: http://svn.apache.org/viewvc?rev=1208603&view=rev
Log:
ACCUMULO-155 merged to trunk

Modified:
    incubator/accumulo/trunk/   (props changed)
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/LongSummation.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumArraySummation.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumSummation.java
    incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java

Propchange: incubator/accumulo/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 30 18:09:27 2011
@@ -1,2 +1,2 @@
 /incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031
-/incubator/accumulo/branches/1.4:1201902-1208496,1208531
+/incubator/accumulo/branches/1.4:1201902-1208600

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/LongSummation.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/LongSummation.java?rev=1208603&r1=1208602&r2=1208603&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/LongSummation.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/LongSummation.java
Wed Nov 30 18:09:27 2011
@@ -23,7 +23,7 @@ import org.apache.log4j.Logger;
 
 /**
  * @deprecated since 1.4
- * @use org.apache.accumulo.core.iterators.user.SummingCombiner with SummingCombiner.Type.LONG
+ * @use org.apache.accumulo.core.iterators.user.SummingCombiner with SummingCombiner.Type.FIXEDLEN
  */
 public class LongSummation implements Aggregator {
   private static final Logger log = Logger.getLogger(LongSummation.class);

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumArraySummation.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumArraySummation.java?rev=1208603&r1=1208602&r2=1208603&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumArraySummation.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumArraySummation.java
Wed Nov 30 18:09:27 2011
@@ -27,7 +27,7 @@ import org.apache.hadoop.io.WritableUtil
 
 /**
  * @deprecated since 1.4
- * @use org.apache.accumulo.core.iterators.user.SummingArrayCombiner with SummingArrayCombiner.Type.VARNUM
+ * @use org.apache.accumulo.core.iterators.user.SummingArrayCombiner with SummingArrayCombiner.Type.VARLONG
  */
 public class NumArraySummation implements Aggregator {
   long[] sum = new long[0];

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumSummation.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumSummation.java?rev=1208603&r1=1208602&r2=1208603&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumSummation.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/NumSummation.java
Wed Nov 30 18:09:27 2011
@@ -27,7 +27,7 @@ import org.apache.hadoop.io.WritableUtil
 
 /**
  * @deprecated since 1.4
- * @use org.apache.accumulo.core.iterators.user.SummingCombiner with SummingCombiner.Type.VARNUM
+ * @use org.apache.accumulo.core.iterators.user.SummingCombiner with SummingCombiner.Type.VARLEN
  */
 public class NumSummation implements Aggregator {
   long sum = 0l;

Modified: incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java?rev=1208603&r1=1208602&r2=1208603&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
(original)
+++ incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
Wed Nov 30 18:09:27 2011
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertTru
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -42,6 +43,9 @@ import org.apache.accumulo.core.iterator
 import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.TypedValueCombiner.Encoder;
+import org.apache.accumulo.core.iterators.aggregation.LongSummation;
+import org.apache.accumulo.core.iterators.aggregation.NumArraySummation;
+import org.apache.accumulo.core.iterators.aggregation.NumSummation;
 import org.apache.accumulo.core.iterators.system.MultiIterator;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
@@ -590,4 +594,34 @@ public class CombinerTest {
     sumArray(SummingArrayCombiner.FixedLongArrayEncoder.class, SummingArrayCombiner.Type.FIXEDLEN);
     sumArray(SummingArrayCombiner.StringArrayEncoder.class, SummingArrayCombiner.Type.STRING);
   }
+  
+  /**
+   * @throws IOException
+   * @deprecated since 1.4
+   */
+  public void testCombinerCompatibility() throws IOException {
+    long[] la = {1l, 2l, 3l};
+    List<Long> ll = new ArrayList<Long>(Arrays.asList((Long) 1l, (Long) 2l, (Long)
3l));
+    assertEquals(ll, SummingArrayCombiner.VAR_LONG_ARRAY_ENCODER.decode(NumArraySummation.longArrayToBytes(la)));
+    assertEquals(la, NumArraySummation.bytesToLongArray(SummingArrayCombiner.VAR_LONG_ARRAY_ENCODER.encode(ll)));
+    testLongEncoding(42l);
+    testLongEncoding(Long.MAX_VALUE);
+    testLongEncoding(Long.MIN_VALUE);
+    testLongEncoding(0l);
+  }
+  
+  /**
+   * @throws IOException
+   * @deprecated since 1.4
+   */
+  public void testLongEncoding(long l) throws IOException {
+    assertEquals((Long) l, SummingCombiner.FIXED_LEN_ENCODER.decode(LongSummation.longToBytes(l)));
+    assertEquals(l, LongSummation.bytesToLong(SummingCombiner.FIXED_LEN_ENCODER.encode(l)));
+    
+    assertEquals((Long) l, SummingCombiner.VAR_LEN_ENCODER.decode(NumSummation.longToBytes(l)));
+    assertEquals(l, NumSummation.bytesToLong(SummingCombiner.VAR_LEN_ENCODER.encode(l)));
+    
+    assertEquals((Long) l, SummingCombiner.STRING_ENCODER.decode(Long.toString(l).getBytes()));
+    assertEquals(l, Long.parseLong(new String(SummingCombiner.STRING_ENCODER.encode(l))));
+  }
 }



Mime
View raw message