Search in sources :

Example 6 with LongLongAccumulator

use of com.hazelcast.jet.accumulator.LongLongAccumulator in project hazelcast by hazelcast.

the class AggregateOperationsTest method when_averagingLong_tooManyItems_then_exception.

@Test
public void when_averagingLong_tooManyItems_then_exception() {
    // Given
    AggregateOperation1<Long, LongLongAccumulator, Double> aggrOp = averagingLong(Long::longValue);
    LongLongAccumulator acc = new LongLongAccumulator(Long.MAX_VALUE, 0L);
    // Then
    exception.expect(ArithmeticException.class);
    // When
    aggrOp.accumulateFn().accept(acc, 0L);
}
Also used : LongLongAccumulator(com.hazelcast.jet.accumulator.LongLongAccumulator) AggregateOperations.averagingLong(com.hazelcast.jet.aggregate.AggregateOperations.averagingLong) AggregateOperations.summingLong(com.hazelcast.jet.aggregate.AggregateOperations.summingLong) AggregateOperations.averagingDouble(com.hazelcast.jet.aggregate.AggregateOperations.averagingDouble) AggregateOperations.summingDouble(com.hazelcast.jet.aggregate.AggregateOperations.summingDouble) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with LongLongAccumulator

use of com.hazelcast.jet.accumulator.LongLongAccumulator in project hazelcast-jet by hazelcast.

the class AggregateOperationsTest method when_averagingLongOverflow_thenException.

@Test
public void when_averagingLongOverflow_thenException() {
    // Given
    AggregateOperation1<Long, LongLongAccumulator, Double> aggrOp = averagingLong(Long::longValue);
    LongLongAccumulator acc = new LongLongAccumulator(Long.MAX_VALUE, 0L);
    // When and Then
    exception.expect(ArithmeticException.class);
    aggrOp.accumulateFn().accept(acc, 0L);
}
Also used : LongLongAccumulator(com.hazelcast.jet.accumulator.LongLongAccumulator) AggregateOperations.averagingLong(com.hazelcast.jet.aggregate.AggregateOperations.averagingLong) AggregateOperations.summingLong(com.hazelcast.jet.aggregate.AggregateOperations.summingLong) AggregateOperations.averagingDouble(com.hazelcast.jet.aggregate.AggregateOperations.averagingDouble) AggregateOperations.summingDouble(com.hazelcast.jet.aggregate.AggregateOperations.summingDouble) Test(org.junit.Test)

Aggregations

LongLongAccumulator (com.hazelcast.jet.accumulator.LongLongAccumulator)7 AggregateOperations.averagingDouble (com.hazelcast.jet.aggregate.AggregateOperations.averagingDouble)4 AggregateOperations.averagingLong (com.hazelcast.jet.aggregate.AggregateOperations.averagingLong)4 AggregateOperations.summingDouble (com.hazelcast.jet.aggregate.AggregateOperations.summingDouble)4 AggregateOperations.summingLong (com.hazelcast.jet.aggregate.AggregateOperations.summingLong)4 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)4 QuickTest (com.hazelcast.test.annotation.QuickTest)4 Test (org.junit.Test)4 Preconditions (com.hazelcast.internal.util.Preconditions)1 JetException (com.hazelcast.jet.JetException)1 KeyedWindowResult (com.hazelcast.jet.datamodel.KeyedWindowResult)1 WindowResult (com.hazelcast.jet.datamodel.WindowResult)1 ProgressState (com.hazelcast.jet.impl.util.ProgressState)1 TestSources (com.hazelcast.jet.pipeline.test.TestSources)1 Long.max (java.lang.Long.max)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 NavigableMap (java.util.NavigableMap)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1