Skip to content

Add more prefix-based tests to like.yamsql #3536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2025

Conversation

alecgrieser
Copy link
Collaborator

@alecgrieser alecgrieser commented Aug 8, 2025

This adds an additional set of tests to like.yamsql that are designed to handle prefix scans where the prefix can be satisfied by an index. Our logic currently doesn't handle transforming LIKE '${str}%' into a tuple scan with a range like [PREFIX_STRING ${str}], which means that we don't use the index as efficiently as we could. This is shown in the explains here, where we only use the index in order to get a set of covering fields, but we don't add it to a scan range.

Note that this is relevant to #3523 (addressing #1076), as if we did turn those kinds of LIKE expressions into prefix string scans, we'd get mixed-mode coverage of the fix for the bug being addressed there. AFAIK, there isn't any other SQL comparison that we have that we could use to generate prefix string scans in some other way.

@arnaud-lacurie
Copy link
Collaborator

arnaud-lacurie commented Aug 11, 2025

In theory, we could also add tests like:

LIKE 'cove_t'

which could be broken down into a prefix search and a residual string comparison, to find covert and covent for example.

…ible with prefix string scans

These would (mostly) require additional compensation in order to get the correct results.
@alecgrieser
Copy link
Collaborator Author

I've added a set of additional test cases that have prefixes but have tails that need to be compensated for. That includes some patterns with underscores (like ca_al) and with wildcards (like ca%al).

@alecgrieser alecgrieser merged commit 72ccc88 into FoundationDB:main Aug 11, 2025
6 checks passed
@alecgrieser alecgrieser deleted the like-prefix-test branch August 11, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing improvement Change that improves our testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants