Skip to content

Commit

Permalink
Revert "Fix decimal agg signature on partial companion function (oap-…
Browse files Browse the repository at this point in the history
…project#465)"

This reverts commit 336d61f.
  • Loading branch information
zhztheplayer committed Jan 5, 2024
1 parent 5460ec3 commit fc3b135
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 3 additions & 4 deletions velox/functions/sparksql/aggregates/AverageAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,9 @@ exec::AggregateRegistrationResult registerAverage(
if (inputType->isShortDecimal()) {
auto inputPrecision = inputType->asShortDecimal().precision();
auto inputScale = inputType->asShortDecimal().scale();
auto sumType = getDecimalSumType(inputPrecision, inputScale);
if (exec::isPartialOutput(step) ||
(step == core::AggregationNode::Step::kSingle &&
resultType->isRow())) {
auto sumType =
DECIMAL(std::min(38, inputPrecision + 10), inputScale);
if (exec::isPartialOutput(step)) {
return std::make_unique<
DecimalAverageAggregate<int64_t, int64_t>>(
resultType, sumType);
Expand Down
8 changes: 1 addition & 7 deletions velox/functions/sparksql/aggregates/SumAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ using SumAggregate = SumAggregateBase<TInput, TAccumulator, ResultType, true>;
TypePtr getDecimalSumType(
const TypePtr& resultType,
core::AggregationNode::Step step) {
if (exec::isPartialOutput(step)) {
return resultType->childAt(0);
}
if (step == core::AggregationNode::Step::kSingle && resultType->isRow()) {
return resultType->childAt(0);
}
return resultType;
return exec::isPartialOutput(step) ? resultType->childAt(0) : resultType;
}
} // namespace

Expand Down

0 comments on commit fc3b135

Please sign in to comment.