Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Aug 28, 2023
1 parent 3cf831d commit 8667bf1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion velox/expression/SwitchExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,17 @@ TypePtr SwitchExpr::resolveType(const std::vector<TypePtr>& argTypes) {
if (hasElse) {
auto& elseClauseType = argTypes.back();

VELOX_CHECK(
if (elseClauseType->isDecimal()) {
// Regard decimals as the same type regardless of precision and scale.
VELOX_CHECK(expressionType->isDecimal());
} else {
VELOX_CHECK(
*elseClauseType == *expressionType,
"Else clause of a SWITCH statement must have the same type as 'then' clauses. "
"Expected {}, but got {}.",
expressionType->toString(),
elseClauseType->toString());
}
}

return expressionType;
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/prestosql/aggregates/AverageAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ exec::AggregateRegistrationResult registerAverage(const std::string& name) {
} // namespace

void registerAverageAggregate(const std::string& prefix) {
registerAverage(prefix + kAvg);
// registerAverage(prefix + kAvg);
}

} // namespace facebook::velox::aggregate::prestosql
4 changes: 2 additions & 2 deletions velox/functions/prestosql/window/Rank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ void registerRankInternal(
}

void registerRank(const std::string& name) {
registerRankInternal<RankType::kRank, int64_t>(name, "bigint");
registerRankInternal<RankType::kRank, int32_t>(name, "integer");
}
void registerDenseRank(const std::string& name) {
registerRankInternal<RankType::kDenseRank, int64_t>(name, "bigint");
registerRankInternal<RankType::kDenseRank, int32_t>(name, "integer");
}
void registerPercentRank(const std::string& name) {
registerRankInternal<RankType::kPercentRank, double>(name, "double");
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/sparksql/aggregates/Register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ void registerAggregateFunctions(const std::string& prefix) {
registerBitwiseXorAggregate(prefix);
registerBloomFilterAggAggregate(prefix + "bloom_filter_agg");
registerAverage(prefix + "avg");
registerDecimalSumAggregate(prefix + "sum");
registerDecimalSumAggregate(prefix + "decimal_sum");
}
} // namespace facebook::velox::functions::aggregate::sparksql

0 comments on commit 8667bf1

Please sign in to comment.