Skip to content

Commit b38bc6e

Browse files
committed
Fix
1 parent 7f71eae commit b38bc6e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

velox/expression/SwitchExpr.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,17 @@ TypePtr SwitchExpr::resolveType(const std::vector<TypePtr>& argTypes) {
253253
if (hasElse) {
254254
auto& elseClauseType = argTypes.back();
255255

256-
VELOX_CHECK(
256+
if (elseClauseType->isDecimal()) {
257+
// Regard decimals as the same type regardless of precision and scale.
258+
VELOX_CHECK(expressionType->isDecimal());
259+
} else {
260+
VELOX_CHECK(
257261
*elseClauseType == *expressionType,
258262
"Else clause of a SWITCH statement must have the same type as 'then' clauses. "
259263
"Expected {}, but got {}.",
260264
expressionType->toString(),
261265
elseClauseType->toString());
266+
}
262267
}
263268

264269
return expressionType;

velox/functions/prestosql/aggregates/AverageAggregate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ exec::AggregateRegistrationResult registerAverage(const std::string& name) {
143143
} // namespace
144144

145145
void registerAverageAggregate(const std::string& prefix) {
146-
registerAverage(prefix + kAvg);
146+
// registerAverage(prefix + kAvg);
147147
}
148148

149149
} // namespace facebook::velox::aggregate::prestosql

velox/functions/sparksql/aggregates/Register.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ void registerAggregateFunctions(const std::string& prefix) {
3232
registerBitwiseXorAggregate(prefix);
3333
registerBloomFilterAggAggregate(prefix + "bloom_filter_agg");
3434
registerAverage(prefix + "avg");
35-
registerDecimalSumAggregate(prefix + "sum");
35+
registerDecimalSumAggregate(prefix + "decimal_sum");
3636
}
3737
} // namespace facebook::velox::functions::aggregate::sparksql

0 commit comments

Comments
 (0)