Skip to content

Commit

Permalink
perf: added check for empty pattern
Browse files Browse the repository at this point in the history
Signed-off-by: Calum Murray <[email protected]>
  • Loading branch information
Cali0707 committed May 9, 2024
1 parent 782e776 commit 19fd3f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sql/v2/expression/like_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func matchString(text, pattern string) bool {
lastWildcardIdx := -1
lastMatchIdx := 0

if patternLen == 0 {
return patternLen == textLen
}

for textIdx < textLen {
if patternIdx < patternLen-1 && pattern[patternIdx] == '\\' &&
((pattern[patternIdx+1] == '_' || pattern[patternIdx+1] == '%') &&
Expand Down

0 comments on commit 19fd3f2

Please sign in to comment.