diff --git a/presto-native-execution/presto_cpp/main/common/Utils.cpp b/presto-native-execution/presto_cpp/main/common/Utils.cpp index 6befe209fc0b8..1ec71fce3e419 100644 --- a/presto-native-execution/presto_cpp/main/common/Utils.cpp +++ b/presto-native-execution/presto_cpp/main/common/Utils.cpp @@ -141,9 +141,6 @@ const std::vector getFunctionNameParts( const std::string& registeredFunction) { std::vector parts; folly::split('.', registeredFunction, parts, true); - VELOX_USER_CHECK( - parts.size() == 3, - fmt::format("Prefix missing for function {}", registeredFunction)); return parts; } } // namespace facebook::presto::util diff --git a/presto-native-execution/presto_cpp/main/common/tests/CommonTest.cpp b/presto-native-execution/presto_cpp/main/common/tests/CommonTest.cpp index 401dc89de9fc5..e7638204c16f7 100644 --- a/presto-native-execution/presto_cpp/main/common/tests/CommonTest.cpp +++ b/presto-native-execution/presto_cpp/main/common/tests/CommonTest.cpp @@ -247,14 +247,6 @@ TEST(UtilsTest, getFunctionNameParts) { EXPECT_EQ(parts[1], "catalog"); EXPECT_EQ(parts[2], "sum"); } - - EXPECT_THROW(util::getFunctionNameParts("catalog.function"), VeloxException); - EXPECT_THROW(util::getFunctionNameParts("function"), VeloxException); - EXPECT_THROW( - util::getFunctionNameParts("prefix.catalog.schema.function"), - VeloxException); - EXPECT_THROW(util::getFunctionNameParts(""), VeloxException); - EXPECT_THROW(util::getFunctionNameParts(".."), VeloxException); } int main(int argc, char** argv) { diff --git a/presto-native-execution/presto_cpp/main/functions/FunctionMetadata.cpp b/presto-native-execution/presto_cpp/main/functions/FunctionMetadata.cpp index 6c7262a83b1b8..38035d19fe6ef 100644 --- a/presto-native-execution/presto_cpp/main/functions/FunctionMetadata.cpp +++ b/presto-native-execution/presto_cpp/main/functions/FunctionMetadata.cpp @@ -278,7 +278,7 @@ json getFunctionsMetadata(const std::optional& catalog) { } const auto parts = util::getFunctionNameParts(name); - if (skipCatalog(parts[0])) { + if (parts.size() < 3 || skipCatalog(parts[0])) { continue; } const auto schema = parts[1]; @@ -291,7 +291,7 @@ json getFunctionsMetadata(const std::optional& catalog) { if (!aggregateFunctions.at(entry.first).metadata.companionFunction) { const auto name = entry.first; const auto parts = util::getFunctionNameParts(name); - if (skipCatalog(parts[0])) { + if (parts.size() < 3 || skipCatalog(parts[0])) { continue; } const auto schema = parts[1]; @@ -308,7 +308,7 @@ json getFunctionsMetadata(const std::optional& catalog) { if (aggregateFunctions.count(entry.first) == 0) { const auto name = entry.first; const auto parts = util::getFunctionNameParts(entry.first); - if (skipCatalog(parts[0])) { + if (parts.size() < 3 || skipCatalog(parts[0])) { continue; } const auto schema = parts[1];