Skip to content

Commit

Permalink
Add overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
liujiayi771 committed Mar 8, 2024
1 parent f0f862b commit 724e8a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions velox/functions/sparksql/aggregates/CentralMomentsAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ struct SkewnessResultAccessor {
template <typename TResultAccessor>
exec::AggregateRegistrationResult registerCentralMoments(
const std::string& name,
bool withCompanionFunctions) {
bool withCompanionFunctions,
bool overwrite) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;
std::vector<std::string> inputTypes = {
"smallint", "integer", "bigint", "real", "double"};
Expand Down Expand Up @@ -97,15 +98,17 @@ exec::AggregateRegistrationResult registerCentralMoments(
TResultAccessor>>(resultType);
}
},
withCompanionFunctions);
withCompanionFunctions,
overwrite);
}
} // namespace

void registerCentralMomentsAggregate(
const std::string& prefix,
bool withCompanionFunctions) {
bool withCompanionFunctions,
bool overwrite) {
registerCentralMoments<SkewnessResultAccessor>(
prefix + "skewness", withCompanionFunctions);
prefix + "skewness", withCompanionFunctions, overwrite);
}

} // namespace facebook::velox::functions::aggregate::sparksql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace facebook::velox::functions::aggregate::sparksql {

void registerCentralMomentsAggregate(
const std::string& name,
bool withCompanionFunctions);
bool withCompanionFunctions,
bool overwrite);

} // namespace facebook::velox::functions::aggregate::sparksql
2 changes: 1 addition & 1 deletion velox/functions/sparksql/aggregates/Register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ void registerAggregateFunctions(
prefix + "bloom_filter_agg", withCompanionFunctions, overwrite);
registerAverage(prefix + "avg", withCompanionFunctions, overwrite);
registerSum(prefix + "sum", withCompanionFunctions, overwrite);
registerCentralMomentsAggregate(prefix, withCompanionFunctions);
registerCentralMomentsAggregate(prefix, withCompanionFunctions, overwrite);
}
} // namespace facebook::velox::functions::aggregate::sparksql

0 comments on commit 724e8a2

Please sign in to comment.