Skip to content

Commit 15d201c

Browse files
committed
Revert "Fix decimal agg signature on partial companion function (#465)"
This reverts commit 336d61f.
1 parent 421454a commit 15d201c

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

velox/functions/sparksql/aggregates/AverageAggregate.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,9 @@ exec::AggregateRegistrationResult registerAverage(
444444
if (inputType->isShortDecimal()) {
445445
auto inputPrecision = inputType->asShortDecimal().precision();
446446
auto inputScale = inputType->asShortDecimal().scale();
447-
auto sumType = getDecimalSumType(inputPrecision, inputScale);
448-
if (exec::isPartialOutput(step) ||
449-
(step == core::AggregationNode::Step::kSingle &&
450-
resultType->isRow())) {
447+
auto sumType =
448+
DECIMAL(std::min(38, inputPrecision + 10), inputScale);
449+
if (exec::isPartialOutput(step)) {
451450
return std::make_unique<
452451
DecimalAverageAggregate<int64_t, int64_t>>(
453452
resultType, sumType);

velox/functions/sparksql/aggregates/SumAggregate.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@ using SumAggregate = SumAggregateBase<TInput, TAccumulator, ResultType, true>;
2929
TypePtr getDecimalSumType(
3030
const TypePtr& resultType,
3131
core::AggregationNode::Step step) {
32-
if (exec::isPartialOutput(step)) {
33-
return resultType->childAt(0);
34-
}
35-
if (step == core::AggregationNode::Step::kSingle && resultType->isRow()) {
36-
return resultType->childAt(0);
37-
}
38-
return resultType;
32+
return exec::isPartialOutput(step) ? resultType->childAt(0) : resultType;
3933
}
4034
} // namespace
4135

0 commit comments

Comments
 (0)