presto-main/src/main/java/io/prestosql/type/LikeFunctions.java/LikeFunctions/isLikePattern
class LikeFunctions:    public static boolean isLikePattern(Slice pattern, Slice escape)
    {
        String stringPattern = pattern.toStringUtf8();
        if (escape == null) {
            return stringPattern.contains("%") || stringPattern.contains("_");
        }

        String stringEscape = escape.toStringUtf8();
        checkCondition(stringEscape.length() == 1, INVALID_FUNCTION_ARGUMENT, "Escape string must be a single character");

        char escapeChar = stringEscape.charAt(0);
        boolean escaped = false;
        boolean isLikePattern = false;
        for (int currentChar : stringPattern.codePoints().toArray()) {
            if (!escaped && (currentChar == escapeChar)) {
                escaped = true;
            }
            else if (escaped) {
                checkEscape(currentChar == '%' || currentChar == '_' || currentChar == escapeChar);
                escaped = false;
            }
            else if ((currentChar == '%') || (currentChar == '_')) {
                isLikePattern = true;
            }
        }
        checkEscape(!escaped);
        return isLikePattern;
    }