diff --git a/velox/functions/sparksql/aggregates/DecimalSumAggregate.h b/velox/functions/sparksql/aggregates/DecimalSumAggregate.h index 2ea6561f66089..4048e5c57742f 100644 --- a/velox/functions/sparksql/aggregates/DecimalSumAggregate.h +++ b/velox/functions/sparksql/aggregates/DecimalSumAggregate.h @@ -130,11 +130,11 @@ class DecimalSumAggregate : public exec::Aggregate { for (auto i = 0; i < numGroups; ++i) { char* group = groups[i]; + clearNull(rawNulls, i); if (isNull(group)) { rawSums[i] = 0; bits::setBit(rawIsEmpty, i, true); } else { - clearNull(rawNulls, i); auto* decimalSum = accumulator(group); bool overflow = false; auto result = (TResultType)computeFinalValue(decimalSum, overflow);