Package org.apache.accumulo.core.iterators.aggregation

Examples of org.apache.accumulo.core.iterators.aggregation.NumSummation


    }
  }
 
  public void test5() {
    try {
      NumSummation ns = new NumSummation();
      for (long l = -5l; l < 8l; l++) {
        ns.collect(new Value(NumSummation.longToBytes(l)));
      }
      long l = NumSummation.bytesToLong(ns.aggregate().get());
      assertTrue("l was " + l, l == 13);
     
      ns.collect(new Value(NumSummation.longToBytes(Long.MAX_VALUE)));
      l = NumSummation.bytesToLong(ns.aggregate().get());
      assertTrue("l was " + l, l == Long.MAX_VALUE);
     
      ns.collect(new Value(NumSummation.longToBytes(Long.MIN_VALUE)));
      l = NumSummation.bytesToLong(ns.aggregate().get());
      assertTrue("l was " + l, l == -1);
     
      ns.collect(new Value(NumSummation.longToBytes(Long.MIN_VALUE)));
      l = NumSummation.bytesToLong(ns.aggregate().get());
      assertTrue("l was " + l, l == Long.MIN_VALUE);
     
      ns.collect(new Value(NumSummation.longToBytes(Long.MIN_VALUE)));
      l = NumSummation.bytesToLong(ns.aggregate().get());
      assertTrue("l was " + l, l == Long.MIN_VALUE);
     
      ns.reset();
      l = NumSummation.bytesToLong(ns.aggregate().get());
      assertTrue("l was " + l, l == 0);
    } catch (Exception e) {
      assertTrue(false);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.iterators.aggregation.NumSummation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.