File tree Expand file tree Collapse file tree 4 files changed +10
-5
lines changed
Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Original file line number Diff line number Diff 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;
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ exec::AggregateRegistrationResult registerAverage(const std::string& name) {
143143} // namespace
144144
145145void registerAverageAggregate (const std::string& prefix) {
146- registerAverage (prefix + kAvg );
146+ // registerAverage(prefix + kAvg);
147147}
148148
149149} // namespace facebook::velox::aggregate::prestosql
Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ void registerRankInternal(
113113}
114114
115115void registerRank (const std::string& name) {
116- registerRankInternal<RankType::kRank , int64_t >(name, " bigint " );
116+ registerRankInternal<RankType::kRank , int32_t >(name, " integer " );
117117}
118118void registerDenseRank (const std::string& name) {
119- registerRankInternal<RankType::kDenseRank , int64_t >(name, " bigint " );
119+ registerRankInternal<RankType::kDenseRank , int32_t >(name, " integer " );
120120}
121121void registerPercentRank (const std::string& name) {
122122 registerRankInternal<RankType::kPercentRank , double >(name, " double" );
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments