Class AbstractSqlPatternMatcher

java.lang.Object
org.apache.drill.exec.expr.fn.impl.AbstractSqlPatternMatcher
All Implemented Interfaces:
SqlPatternMatcher
Direct Known Subclasses:
SqlPatternConstantMatcher, SqlPatternContainsMatcher, SqlPatternEndsWithMatcher, SqlPatternStartsWithMatcher

public abstract class AbstractSqlPatternMatcher extends Object implements SqlPatternMatcher
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.
  • Field Details

    • patternString

      protected final String patternString
    • patternLength

      protected final int patternLength
    • patternByteBuffer

      protected final ByteBuffer patternByteBuffer
  • Constructor Details

    • AbstractSqlPatternMatcher

      public AbstractSqlPatternMatcher(String patternString)