Skip to content

test: Add end to end tests for string functions#26950

Open
allenshen13 wants to merge 1 commit intomasterfrom
add-string-function-tests
Open

test: Add end to end tests for string functions#26950
allenshen13 wants to merge 1 commit intomasterfrom
add-string-function-tests

Conversation

@allenshen13
Copy link
Copy Markdown
Member

@allenshen13 allenshen13 commented Jan 13, 2026

Description

Add E2E tests for bit_length, longest_common_prefix, replace_first

Motivation and Context

Closes #26936

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 ==

@allenshen13 allenshen13 requested review from a team as code owners January 13, 2026 00:26
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Jan 13, 2026
@prestodb-ci prestodb-ci requested review from a team, anandamideShakyan and wanglinsong and removed request for a team January 13, 2026 00:26
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Jan 13, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds end-to-end native execution tests for the string functions bit_length, longest_common_prefix, and replace_first within the existing string functions test suite.

File-Level Changes

Change Details Files
Extend native worker string function E2E test coverage to include bit_length, longest_common_prefix, and replace_first with both generic and edge-case assertions.
  • Add bit_length queries over nation.name and orders.comment plus explicit empty-string and literal cases with expected bit lengths
  • Add longest_common_prefix queries over nation.name and orders.comment plus explicit empty-string and partial-prefix literal cases with expected prefixes
  • Add replace_first queries over orders.comment and nation.name plus literal replacement cases including repeated characters and whitespace removal
presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeGeneralQueries.java

Assessment against linked issues

Issue Objective Addressed Explanation
#26936 Add end-to-end tests for the bit_length string function.
#26936 Add end-to-end tests for the longest_common_prefix string function.
#26936 Add end-to-end tests for the replace_first string function.

Possibly linked issues


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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 13, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA ea416c0.
Ensure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@allenshen13 allenshen13 force-pushed the add-string-function-tests branch from 1bd9162 to a7151e1 Compare January 13, 2026 00:30
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 left some high level feedback:

  • For the tests that only exercise scalar behavior with literals (e.g., bit_length(''), longest_common_prefix('', ''), replace_first('aaa', 'a', 'b')), consider using VALUES instead of FROM nation to avoid unnecessary table scans and keep the E2E suite leaner.
  • The new SELECT ... FROM orders/nation assertions without LIMIT (e.g., bit_length(comment), replace_first(comment, 'the', 'THE')) will compare full table results between engines; if the intent is just to exercise the function end-to-end, you might want to narrow these (e.g., with LIMIT or a restricted predicate) to reduce test runtime.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- For the tests that only exercise scalar behavior with literals (e.g., `bit_length('')`, `longest_common_prefix('', '')`, `replace_first('aaa', 'a', 'b')`), consider using `VALUES` instead of `FROM nation` to avoid unnecessary table scans and keep the E2E suite leaner.
- The new `SELECT ... FROM orders/nation` assertions without `LIMIT` (e.g., `bit_length(comment)`, `replace_first(comment, 'the', 'THE')`) will compare full table results between engines; if the intent is just to exercise the function end-to-end, you might want to narrow these (e.g., with `LIMIT` or a restricted predicate) to reduce test runtime.

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.

@allenshen13 allenshen13 force-pushed the add-string-function-tests branch from a7151e1 to 32df666 Compare January 13, 2026 00:36
@steveburnett
Copy link
Copy Markdown
Contributor

Thanks for the release note! Formatting nit:

== RELEASE NOTES ==

General Changes
* Add end to end tests for string functions bit_length, longest_common_prefix. replace_first.

You can delete everything after the Add end to end tests line, including the NO RELEASE NOTES text and instructions following that.

@allenshen13 allenshen13 force-pushed the add-string-function-tests branch 2 times, most recently from beb791f to 2245230 Compare January 14, 2026 21:22
Copy link
Copy Markdown
Contributor

@jkhaliqi jkhaliqi left a comment

Choose a reason for hiding this comment

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

@allenshen13 Thanks for the tests!

@allenshen13 allenshen13 force-pushed the add-string-function-tests branch from 2245230 to af7b992 Compare February 10, 2026 18:45
@allenshen13 allenshen13 force-pushed the add-string-function-tests branch from af7b992 to b5155f9 Compare March 12, 2026 22:53
@aditi-pandit
Copy link
Copy Markdown
Contributor

@allenshen13 : Can you rebase your code ? I'll approve after the tests run successfully.

@allenshen13 allenshen13 force-pushed the add-string-function-tests branch from b5155f9 to 44003d4 Compare April 2, 2026 22:29
@allenshen13 allenshen13 force-pushed the add-string-function-tests branch from 44003d4 to ea416c0 Compare April 4, 2026 00:47
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.

Add end to end tests for string functions

5 participants