diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/LongSumAggregation.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/LongSumAggregation.java
index <HASH>..<HASH> 100644
--- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/LongSumAggregation.java
+++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/LongSumAggregation.java
@@ -17,6 +17,7 @@ import com.facebook.presto.operator.aggregation.state.NullableLongState;
 import com.facebook.presto.spi.block.BlockBuilder;
 import com.facebook.presto.spi.type.BigintType;
 import com.facebook.presto.spi.type.StandardTypes;
+import com.facebook.presto.type.BigintOperators;
 import com.facebook.presto.type.SqlType;
 
 @AggregationFunction("sum")
@@ -31,7 +32,7 @@ public final class LongSumAggregation
     public static void sum(NullableLongState state, @SqlType(StandardTypes.BIGINT) long value)
     {
         state.setNull(false);
-        state.setLong(state.getLong() + value);
+        state.setLong(BigintOperators.add(state.getLong(), value));
     }
 
     @OutputFunction(StandardTypes.BIGINT)
Check for overflow in SUM aggregation for BIGINTs

Aggregate query with SUM() is aborted as soon as overflow occurs.