Skip to content

Commit

Permalink
fix(replace_first): Fix up registration of replace_first (facebookinc…
Browse files Browse the repository at this point in the history
…ubator#11556)

Summary:
The function should be replace_first not replaceFirst. This was incorrectly registered so users were not picking it up. Registering it to the correct name now.

Pull Request resolved: facebookincubator#11556

Reviewed By: amitkdutta

Differential Revision: D66027440

fbshipit-source-id: b57965fc3380f4e50783410d6f85781da48b2e79
  • Loading branch information
yuandagits authored and facebook-github-bot committed Nov 16, 2024
1 parent 00e8149 commit 90bbdaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void registerStringFunctions(const std::string& prefix) {
registerSplitToMap(prefix);

VELOX_REGISTER_VECTOR_FUNCTION(udf_concat, prefix + "concat");
VELOX_REGISTER_VECTOR_FUNCTION(udf_replaceFirst, prefix + "replaceFirst");
VELOX_REGISTER_VECTOR_FUNCTION(udf_replaceFirst, prefix + "replace_first");
VELOX_REGISTER_VECTOR_FUNCTION(udf_replace, prefix + "replace");
VELOX_REGISTER_VECTOR_FUNCTION(udf_reverse, prefix + "reverse");
VELOX_REGISTER_VECTOR_FUNCTION(udf_to_utf8, prefix + "to_utf8");
Expand Down
6 changes: 3 additions & 3 deletions velox/functions/prestosql/tests/StringFunctionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ void StringFunctionsTest::testReplaceInPlace(
auto result = evaluate<FlatVector<StringView>>(
fmt::format(
"{}(c0, '{}', '{}')",
replaceFirst ? "replaceFirst" : "replace",
replaceFirst ? "replace_first" : "replace",
search,
replace),
makeRowVector({makeInput()}));
Expand All @@ -1412,7 +1412,7 @@ void StringFunctionsTest::testReplaceInPlace(
core::QueryConfig config({});
auto replaceFunction = replaceFirst
? exec::getVectorFunction(
"replaceFirst", {VARCHAR(), VARCHAR(), VARCHAR()}, {}, config)
"replace_first", {VARCHAR(), VARCHAR(), VARCHAR()}, {}, config)
: exec::getVectorFunction(
"replace", {VARCHAR(), VARCHAR()}, {}, config);
SelectivityVector rows(tests.size());
Expand Down Expand Up @@ -1459,7 +1459,7 @@ void StringFunctionsTest::testReplaceFlatVector(
FlatVectorPtr<StringView> result;
if (replaceFirst) {
result = evaluate<FlatVector<StringView>>(
"replaceFirst(c0, c1, c2)",
"replace_first(c0, c1, c2)",
makeRowVector({stringVector, searchVector, replaceVector}));
} else if (withReplaceArgument) {
result = evaluate<FlatVector<StringView>>(
Expand Down

0 comments on commit 90bbdaa

Please sign in to comment.