Skip to content

Conversation

@amitkdutta
Copy link
Contributor

Description

Throwing proper error code for better error classification.

Motivation and Context

We see queries failing with Unsupported type parameters (BoundVariables{typeVariables={T=array(varchar)}, longVariables={}}) for presto.default.approx_distinct<T>(T):bigint where parmater isn't supported. This is simply user error (also the error message suggests so). Throwing user error code in this case reudce unnecessary retry, miscategorization and send proper signal to users.

Impact

None

Test Plan

Existing

== NO RELEASE NOTE ==

@amitkdutta amitkdutta requested a review from a team as a code owner November 6, 2025 14:37
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Nov 6, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 6, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Update the error code thrown in scalar function specialization for unsupported type parameters from FUNCTION_IMPLEMENTATION_MISSING to NOT_SUPPORTED to ensure proper user error classification.

Class diagram for updated error handling in ParametricScalar

classDiagram
class ParametricScalar {
  +specialize(boundVariables)
}
ParametricScalar --> PrestoException
class PrestoException {
  +PrestoException(errorCode, message)
}
%% Error codes used
class FUNCTION_IMPLEMENTATION_MISSING
class NOT_SUPPORTED
PrestoException --> FUNCTION_IMPLEMENTATION_MISSING
PrestoException --> NOT_SUPPORTED
Loading

File-Level Changes

Change Details Files
Switch error code for unsupported type parameters
  • Changed thrown PrestoException from FUNCTION_IMPLEMENTATION_MISSING to NOT_SUPPORTED
  • Updated import to reference NOT_SUPPORTED error code
presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ParametricScalar.java

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 and they look great!


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.

@swapsmagic
Copy link
Contributor

Can we introduce unit or integration tests to make sure this functionality has been verified?

Copy link
Contributor

@swapsmagic swapsmagic left a comment

Choose a reason for hiding this comment

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

Let's add unit test and should be good to merge.

@amitkdutta amitkdutta changed the title fix: Throw USER_ERROR instead of FUNCTION_IMPLEMENTATION_MISSING for unsupported parameters. fix: Throw USER_ERROR instead of FUNCTION_IMPLEMENTATION_MISSING for unsupported parameters Nov 8, 2025
@amitkdutta amitkdutta merged commit 7497682 into prestodb:master Nov 8, 2025
81 of 83 checks passed
tdcmeehan pushed a commit that referenced this pull request Nov 10, 2025
## Description

PR #26553 changed the error code from `FUNCTION_IMPLEMENTATION_MISSING`
to `NOT_SUPPORTED` where parameter isn't supported to reduce unnecessary
retry. This PR fix the relevant test case to eliminate the test failure.


## Motivation and Context

 - Eliminate test failure

## Impact

N/A

## Test Plan

N/A

## Contributor checklist

- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#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](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.
- [ ] If adding new dependencies, verified they have an [OpenSSF
Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or
higher (or obtained explicit TSC approval for lower scores).

## Release Notes

```
== NO RELEASE NOTE ==
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:Meta PR from Meta

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants