Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions presto-native-execution/presto_cpp/main/common/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ const std::vector<std::string> getFunctionNameParts(
const std::string& registeredFunction) {
std::vector<std::string> 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
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ json getFunctionsMetadata(const std::optional<std::string>& catalog) {
}

const auto parts = util::getFunctionNameParts(name);
if (skipCatalog(parts[0])) {
if (parts.size() < 3 || skipCatalog(parts[0])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A helper function, skipFunction(std::vector<std::string>& parts), could be added in FunctionMetadata.cpp to include both these criteria?

continue;
}
const auto schema = parts[1];
Expand All @@ -291,7 +291,7 @@ json getFunctionsMetadata(const std::optional<std::string>& 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];
Expand All @@ -308,7 +308,7 @@ json getFunctionsMetadata(const std::optional<std::string>& 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];
Expand Down
Loading