use of com.facebook.presto.operator.aggregation.state.LongDecimalWithOverflowState in project presto by prestodb.
the class TestDecimalSumAggregation method testCombineUnderflow.
@Test
public void testCombineUnderflow() {
addToState(state, TWO.pow(125).negate());
addToState(state, TWO.pow(126).negate());
LongDecimalWithOverflowState otherState = new LongDecimalWithOverflowStateFactory().createSingleState();
addToState(otherState, TWO.pow(125).negate());
addToState(otherState, TWO.pow(126).negate());
DecimalSumAggregation.combine(state, otherState);
assertEquals(state.getOverflow(), -1);
assertEquals(state.getLongDecimal(), unscaledDecimal(TWO.pow(126).negate()));
}
use of com.facebook.presto.operator.aggregation.state.LongDecimalWithOverflowState in project presto by prestodb.
the class TestDecimalSumAggregation method testCombineOverflow.
@Test
public void testCombineOverflow() {
addToState(state, TWO.pow(125));
addToState(state, TWO.pow(126));
LongDecimalWithOverflowState otherState = new LongDecimalWithOverflowStateFactory().createSingleState();
addToState(otherState, TWO.pow(125));
addToState(otherState, TWO.pow(126));
DecimalSumAggregation.combine(state, otherState);
assertEquals(state.getOverflow(), 1);
assertEquals(state.getLongDecimal(), unscaledDecimal(TWO.pow(126)));
}
Aggregations