Skip to content

Commit

Permalink
feat: registration api to return invalid status if function already r…
Browse files Browse the repository at this point in the history
…egistered
  • Loading branch information
sanjibansg committed Jun 2, 2022
1 parent b6ccc36 commit 5fd670a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpp/src/arrow/engine/substrait/extension_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,19 @@ ExtensionIdRegistry* default_extension_id_registry() {
Status FunctionMapping::AddArrowToSubstrait(std::string arrow_function_name, ArrowToSubstrait conversion_func){
if (arrow_to_substrait.find(arrow_function_name) != arrow_to_substrait.end()){
arrow_to_substrait[arrow_function_name] = conversion_func;
return Status::OK();
} else{
return Status::Invalid("Arrow function already exist in the conversion map");
}
return Status::OK();
}

Status FunctionMapping::AddSubstraitToArrow(std::string substrait_function_name, SubstraitToArrow conversion_func){
if (substrait_to_arrow.find(substrait_function_name) != substrait_to_arrow.end()){
substrait_to_arrow[substrait_function_name] = conversion_func;
return Status::OK();
} else{
return Status::Invalid("Substrait function already exist in the conversion map");
}
return Status::OK();
}

Result<SubstraitToArrow> FunctionMapping::GetArrowFromSubstrait(std::string name) const {
Expand Down

0 comments on commit 5fd670a

Please sign in to comment.