private static boolean find(Text s, Text sub, int startS, int endS) {
    byte[] byteS = s.getBytes();
    byte[] byteSub = sub.getBytes();
    int lenSub = sub.getLength();
    boolean match = false;
    for (int i = startS; (i < endS - lenSub + 1) && (!match); i++) {
      match = true;
      for (int j = 0; j < lenSub; j++) {
        if (byteS[j + i] != byteSub[j]) {
          match = false;
          break;
        }
      }
    }
    return match;
  }
Parses the likePattern. Based on it is a simple pattern or not, the
function might change two member variables. {@link #type} will be changed
to the corresponding pattern type; {@link #simplePattern} will record the
string in it for later pattern matching if it is a simple pattern.
<p>
Examples: <blockquote>

<pre>
parseSimplePattern("%abc%") changes {@link #type} to PatternType.MIDDLE
and changes {@link #simplePattern} to "abc"
parseSimplePattern("%ab_c%") changes {@link #type} to PatternType.COMPLEX
and does not change {@link #simplePattern}
</pre>

</blockquote>

@param likePattern
         the input LIKE query pattern
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java