Skip to content

fix(native): Replace raw assert() with VELOX_CHECK in PrestoToVeloxConnectorUtils#27306

Merged
tanjialiang merged 2 commits intoprestodb:masterfrom
tanjialiang:export-D95995395
Mar 11, 2026
Merged

fix(native): Replace raw assert() with VELOX_CHECK in PrestoToVeloxConnectorUtils#27306
tanjialiang merged 2 commits intoprestodb:masterfrom
tanjialiang:export-D95995395

Conversation

@tanjialiang
Copy link
Copy Markdown
Contributor

@tanjialiang tanjialiang commented Mar 10, 2026

Summary:
2 raw C assert() calls are no-ops in release builds (NDEBUG), meaning
these invariant checks silently disappear in production. Replace with
VELOX_CHECK_LE and VELOX_CHECK_GT which are always active and
provide better error messages on failure.

Differential Revision: D95995395

Summary by Sourcery

Replace non-production C asserts in PrestoToVeloxConnectorUtils with always-on Velox checks to enforce integer range invariants at runtime.

Bug Fixes:

  • Ensure integer range invariants in combineIntegerRanges are enforced in release builds by replacing raw assert calls with VELOX_CHECK macros.

Enhancements:

  • Include Velox Exceptions header to support standardized runtime checks in connector utilities.
== NO RELEASE NOTE ==

@tanjialiang tanjialiang requested review from a team as code owners March 10, 2026 22:16
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Mar 10, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 10, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces two raw C assert() calls in PrestoToVeloxConnectorUtils with always-enabled VELOX_CHECK_* macros and adds the required Velox exceptions header, ensuring invariants are enforced in release builds with better error messages.

File-Level Changes

Change Details Files
Replace raw assert-based invariants in integer range combination logic with VELOX_CHECK macros that are active in all build modes.
  • Include Velox Exceptions header to access VELOX_CHECK_* macros.
  • Replace an assert on the gap between two bigint filter bounds with VELOX_CHECK_LE using the same condition.
  • Replace an assert on bigintFilters size being greater than 1 with VELOX_CHECK_GT to enforce the precondition at runtime.
presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnectorUtils.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
Copy Markdown
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 - 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.

@tanjialiang tanjialiang changed the title Replace raw assert() with VELOX_CHECK in PrestoToVeloxConnectorUtils fix(native): Replace raw assert() with VELOX_CHECK in PrestoToVeloxConnectorUtils Mar 10, 2026
gggrace14
gggrace14 previously approved these changes Mar 10, 2026
…tive-execution

Summary:
3 production sites throw raw `std::invalid_argument`, which bypasses
`VeloxToPrestoExceptionTranslator` and misclassifies user errors as
`GENERIC_INTERNAL_ERROR`. Replace them with `VELOX_USER_FAIL` so they
are properly translated to user-facing Presto error codes.

Sites fixed:
- `PrestoExchangeSource.cpp` - invalid task ID in remote split URL
- `PrestoToVeloxExpr.cpp:131` - unexpected Block type
- `PrestoToVeloxExpr.cpp:905` - unsupported RowExpression type

Differential Revision: D96025465
tanjialiang added a commit to tanjialiang/presto that referenced this pull request Mar 11, 2026
…restodb#27306)

Summary:

2 raw C `assert()` calls are no-ops in release builds (NDEBUG), meaning
these invariant checks silently disappear in production. Replace with
`VELOX_CHECK_LE` and `VELOX_CHECK_GT` which are always active and
provide better error messages on failure.

Reviewed By: kewang1024

Differential Revision: D95995395
…restodb#27306)

Summary:
Pull Request resolved: prestodb#27306

2 raw C `assert()` calls are no-ops in release builds (NDEBUG), meaning
these invariant checks silently disappear in production. Replace with
`VELOX_CHECK_LE` and `VELOX_CHECK_GT` which are always active and
provide better error messages on failure.

Reviewed By: kewang1024

Differential Revision: D95995395
@gggrace14 gggrace14 self-requested a review March 11, 2026 21:50
@tanjialiang tanjialiang merged commit e7b539b into prestodb:master Mar 11, 2026
113 of 114 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants