Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/907#discussion_r134032668
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/RegexpUtil.java
---
@@ -76,12 +113,24 @@ public static String sqlToRegexLike(
/**
* Translates a SQL LIKE pattern to Java regex pattern.
*/
- public static String sqlToRegexLike(
+ public static sqlPatternInfo sqlToRegexLike(
String sqlPattern,
char escapeChar) {
int i;
final int len = sqlPattern.length();
final StringBuilder javaPattern = new StringBuilder(len + len);
+ final StringBuilder simplePattern = new StringBuilder(len);
+
+ // Figure out the pattern type and build simplePatternString
+ // as we are going through the sql pattern string
+ // to build java regex pattern string. This is better instead of using
+ // regex later for determining if a pattern is simple or not.
+ // Saves CPU cycles.
+ sqlPatternType patternType = sqlPatternType.NOT_SIMPLE;
+ boolean startsWith = false;
+ boolean endsWith = false;
+ boolean notSimple = false;
--- End diff --
These are not independent states. Probably better to use your enum, with
the initial value as null (unknown).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---