Skip to content

Fix LOOKUP STARTS WITH empty string rewrite#6148

Open
officialasishkumar wants to merge 1 commit into
vesoft-inc:masterfrom
officialasishkumar:fix/lookup-empty-startswith
Open

Fix LOOKUP STARTS WITH empty string rewrite#6148
officialasishkumar wants to merge 1 commit into
vesoft-inc:masterfrom
officialasishkumar:fix/lookup-empty-startswith

Conversation

@officialasishkumar
Copy link
Copy Markdown

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number: #6115

Description:

LOOKUP ... WHERE <prop> STARTS WITH "" can crash graphd when the optimizer rewrites STARTS WITH for an index range scan. The rewrite reads past the end of the empty string while trying to increment the upper bound.

How do you solve it?

Handle the empty-prefix case explicitly by rewriting it to a lower-bound range (prop >= ""), which matches every non-null indexed string value. Also fix the non-empty boundary increment to use back() instead of dereferencing end(), and add unit plus TCK coverage.

Special notes for your reviewer, ex. impact of this fix, design document, etc:

Local target build was blocked before reaching this change by an existing GCC 13 -Werror=interference-size warning in MemoryTracker.h. git diff --check passed.

Checklist:

Tests:

  • Unit test(positive and negative cases)
  • Function test
  • Performance test
  • N/A

Affects:

  • Documentation affected (Please add the label if documentation needs to be modified.)
  • Incompatibility (If it breaks the compatibility, please describe it and add the label.)
  • If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
  • Performance impacted: Consumes more CPU/Memory

Release notes:

Please confirm whether to be reflected in release notes and how to describe:

Fixed a graphd crash when optimizing LOOKUP queries with STARTS WITH "".

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants