Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Sep 15, 2023
1 parent f184fca commit 871b01f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions velox/common/memory/SharedArbitrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,11 @@ uint64_t SharedArbitrator::reclaim(
const uint64_t newCapacity = pool->capacity();
VELOX_CHECK_GE(oldCapacity, newCapacity);
reclaimedBytes = oldCapacity - newCapacity;
numReclaimedBytes_ += reclaimedBytes - freedBytes;
numShrunkBytes_ += freedBytes;
reclaimTimeUs_ += reclaimDurationUs;
return reclaimedBytes;
numReclaimedBytes_ += reclaimedBytes - freedBytes;
numShrunkBytes_ += freedBytes;
reclaimTimeUs_ += reclaimDurationUs;
return reclaimedBytes;
}
}

void SharedArbitrator::abort(
Expand Down
3 changes: 2 additions & 1 deletion velox/functions/sparksql/DecimalVectorFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ class DecimalRoundFunction : public exec::VectorFunction {
uint8_t rScale,
int32_t scale) const {
if (scale >= 0) {
bool isOverflow = false;
auto rescaledValue = DecimalUtil::rescaleWithRoundUp<A, R>(
a, aPrecision, aScale, rPrecision, rScale);
a, aPrecision, aScale, rPrecision, rScale, isOverflow);
VELOX_DCHECK(rescaledValue.has_value());
r = rescaledValue.value();
} else {
Expand Down
3 changes: 2 additions & 1 deletion velox/functions/sparksql/aggregates/AverageAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ class DecimalAverageAggregate : public DecimalAggregate<TInputType> {

DecimalUtil::divideWithRoundUp<int128_t, int128_t, int128_t>(
avg, validSum.value(), countDecimal, false, sumRescale, 0);
bool isOverflow = false;
return DecimalUtil::rescaleWithRoundUp<int128_t, TResultType>(
avg, avgPrecision, avgScale, resultPrecision, resultScale);
avg, avgPrecision, avgScale, resultPrecision, resultScale, isOverflow);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/sparksql/aggregates/DecimalSumAggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DecimalSumAggregate : public exec::Aggregate {

auto [resultPrecision, resultScale] =
getDecimalPrecisionScale(*sumType_.get());
overflow = !DecimalUtil::valueInRangeWithPrecision(sum, resultPrecision);
overflow = !DecimalUtil::valueInPrecisionRange(sum, resultPrecision);
return sum;
}

Expand Down

0 comments on commit 871b01f

Please sign in to comment.