Skip to content

Commit

Permalink
Remove the function registration from Velox validation (oap-project#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
lviiii authored and zhejiangxiaomai committed Dec 12, 2022
1 parent 6458dac commit ab69b45
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
7 changes: 1 addition & 6 deletions velox/functions/prestosql/aggregates/AverageAggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,18 @@ class AverageAggregate : public exec::Aggregate {
if (decodedPartial_.isConstantMapping()) {
if (!decodedPartial_.isNullAt(0)) {
auto decodedIndex = decodedPartial_.index(0);
if (!baseSumVector->isNullAt(decodedIndex)) {
auto count = baseCountVector->valueAt(decodedIndex);
auto sum = baseSumVector->valueAt(decodedIndex);
rows.applyToSelected([&](vector_size_t i) {
updateNonNullValue(groups[i], count, sum);
});
}
}
} else if (decodedPartial_.mayHaveNulls() || baseSumVector->mayHaveNulls()) {
} else if (decodedPartial_.mayHaveNulls()) {
rows.applyToSelected([&](vector_size_t i) {
if (decodedPartial_.isNullAt(i)) {
return;
}
auto decodedIndex = decodedPartial_.index(i);
if (baseSumVector->isNullAt(decodedIndex)) {
return;
}
updateNonNullValue(
groups[i],
baseCountVector->valueAt(decodedIndex),
Expand Down
5 changes: 0 additions & 5 deletions velox/substrait/SubstraitToVeloxPlanValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

#include "velox/substrait/SubstraitToVeloxPlanValidator.h"
#include "TypeUtils.h"
#include "velox/functions/sparksql/Register.h"

#include "velox/functions/prestosql/registration/RegistrationFunctions.h"

namespace facebook::velox::substrait {

Expand Down Expand Up @@ -337,8 +334,6 @@ bool SubstraitToVeloxPlanValidator::validate(
}

bool SubstraitToVeloxPlanValidator::validate(const ::substrait::Plan& sPlan) {
functions::prestosql::registerAllScalarFunctions();
functions::sparksql::registerFunctions("");
// Create plan converter and expression converter to help the validation.
planConverter_->constructFunctionMap(sPlan);
exprConverter_ = std::make_shared<SubstraitVeloxExprConverter>(
Expand Down

0 comments on commit ab69b45

Please sign in to comment.