Skip to content

Commit

Permalink
[VL] Align names of decimal compare functions (#3593)
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo authored Nov 6, 2023
1 parent 16e2874 commit 7185955
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions cpp/velox/substrait/SubstraitParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,17 @@ std::string SubstraitParser::findVeloxFunction(
std::string SubstraitParser::mapToVeloxFunction(const std::string& substraitFunction, bool isDecimal) {
auto it = substraitVeloxFunctionMap_.find(substraitFunction);
if (isDecimal) {
if (substraitFunction == "round" || substraitFunction == "lt" || substraitFunction == "lte" ||
substraitFunction == "gt" || substraitFunction == "gte") {
return "decimal_" + substraitFunction;
if (substraitFunction == "lt" || substraitFunction == "lte" || substraitFunction == "gt" ||
substraitFunction == "gte" || substraitFunction == "equal") {
return "decimal_" + it->second;
}
if (substraitFunction == "equal") {
return "decimal_eq";
if (substraitFunction == "round") {
return "decimal_round";
}
}
if (it != substraitVeloxFunctionMap_.end()) {
return it->second;
}

// If not finding the mapping from Substrait function name to Velox function
// name, the original Substrait function name will be used.
return substraitFunction;
Expand Down
2 changes: 1 addition & 1 deletion cpp/velox/substrait/SubstraitToVeloxPlan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ void SubstraitToVeloxPlanConverter::extractJoinKeys(
if (funcName == "and") {
expressions.push_back(&args[0].value());
expressions.push_back(&args[1].value());
} else if (funcName == "eq" || funcName == "equalto" || funcName == "decimal_eq") {
} else if (funcName == "eq" || funcName == "equalto" || funcName == "decimal_equalto") {
VELOX_CHECK(std::all_of(args.cbegin(), args.cend(), [](const ::substrait::FunctionArgument& arg) {
return arg.value().has_selection();
}));
Expand Down

0 comments on commit 7185955

Please sign in to comment.