To get good performance for most commonly used pattern matches
CONSTANT('ABC')
SqlPatternConstantMatcher
STARTSWITH('%ABC')
SqlPatternStartsWithMatcher
ENDSWITH('ABC%')
SqlPatternEndsWithMatcher
CONTAINS('%ABC%')
SqlPatternContainsMatcher
we have simple pattern matchers.
Idea is to have our own implementation for simple pattern matchers so we can
avoid heavy weight regex processing, skip UTF-8 decoding and char conversion.
Instead, we encode the pattern string and do byte comparison against native memory.
Overall, this approach
gives us orders of magnitude performance improvement for simple pattern matches.
Anything that is not simple is considered
complex pattern and we use Java regex for complex pattern matches.