Skip to content

Conversation

@PingLiuPing
Copy link
Contributor

Description

There is a force restriction on Velox function name such as catalog.schema.function_name. If the function name does consist of three parts it leads to failure check immediately.
This can causes worker node to crash etc. See discussion from #26584.
But we should not impose this rules from Prestissimo to Velox functions. Velox might register some functions that does not follow the Prestissimo rules. From Prestissimo point of view, it can just ignore those functions that do not have 3 part name.

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

@PingLiuPing PingLiuPing requested review from a team as code owners November 21, 2025 14:23
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Nov 21, 2025
@prestodb-ci prestodb-ci requested review from a team, agrawalreetika and jkhaliqi and removed request for a team November 21, 2025 14:23
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 21, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR relaxes the strict requirement that Velox function names must have exactly three dot-separated components and instead treats non-3-part names as ignorable during metadata collection, removing the previous hard failure behavior and updating callers and tests accordingly.

Updated class diagram for function metadata utilities

classDiagram
  class Util {
    +getFunctionNameParts(registeredFunction : std::string) std::vector<std::string>
  }

  class FunctionMetadata {
    +getFunctionsMetadata(catalog : std::optional<std::string>) json
    -skipCatalog(catalog : std::string) bool
  }

  FunctionMetadata ..> Util : uses getFunctionNameParts

  note for Util "Previously enforced parts.size() == 3 with a VELOX_USER_CHECK; this constraint has been removed so it returns whatever parts are present."
  note for FunctionMetadata "Now checks parts.size() < 3 and skips such functions instead of relying on Util to enforce a 3-part name."
Loading

File-Level Changes

Change Details Files
Remove the hard check that function names must have exactly three dot-separated parts and allow any number of parts.
  • Update getFunctionNameParts to simply split on '.' without validating part count
  • Stop throwing VeloxException for non-3-part or empty function names
presto-native-execution/presto_cpp/main/common/Utils.cpp
Make function metadata collection robust to functions whose names do not have three parts by skipping them instead of failing.
  • Adjust catalog function metadata generation to skip entries with fewer than three name parts
  • Guard aggregate and non-aggregate function metadata paths with a size check before accessing catalog and schema indices
presto-native-execution/presto_cpp/main/functions/FunctionMetadata.cpp
Align tests with the new relaxed behavior for function name parsing.
  • Remove expectations that getFunctionNameParts throws on invalid or oddly formatted function names
presto-native-execution/presto_cpp/main/common/tests/CommonTest.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • By removing the size check in getFunctionNameParts and only checking parts.size() < 3 in getFunctionsMetadata, inputs like an empty string or ".." will now produce parts with empty strings that are not filtered out, so consider adding validation or an explicit guard against empty segments before using schema/name indices.
  • getFunctionsMetadata now repeats the same parts.size() < 3 || skipCatalog(parts[0]) check in three places; consider extracting this into a small helper or lambda to keep the logic consistent and easier to maintain if the criteria change again.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- By removing the size check in getFunctionNameParts and only checking parts.size() < 3 in getFunctionsMetadata, inputs like an empty string or ".." will now produce parts with empty strings that are not filtered out, so consider adding validation or an explicit guard against empty segments before using schema/name indices.
- getFunctionsMetadata now repeats the same `parts.size() < 3 || skipCatalog(parts[0])` check in three places; consider extracting this into a small helper or lambda to keep the logic consistent and easier to maintain if the criteria change again.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks @PingLiuPing.


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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants