deniskuzZ commented on code in PR #4998:
URL: https://github.com/apache/hive/pull/4998#discussion_r1526034737


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStringColLikeStringScalar.java:
##########
@@ -140,4 +133,93 @@ public Checker tryCreate(String pattern) {
       return new ComplexChecker("^" + UDFLike.likePatternToRegExp(pattern) + 
"$");
     }
   }
+
+  private enum PatternType {
+    NONE, // "abc"
+    BEGIN, // "abc%"
+    END, // "%abc"
+    MIDDLE, // "%abc%"
+    CHAINED, // "abc%def%ghi%"
+    COMPLEX, // all other cases, such as "ab%c_de"
+  }
+
+  /**
+   * Check the LIKE pattern..
+   */
+  private static class CheckerPattern {
+    private final String pattern;
+    private final PatternType type;
+
+    public CheckerPattern(PatternType type, String pattern) {
+      this.type = type;
+      this.pattern = pattern;
+    }
+
+    public String check() {
+      PatternType lastType = PatternType.NONE;
+      int length = pattern.length();
+      int beginIndex = 0;
+      int endIndex = length;
+      char lastChar = 'a';

Review Comment:
   it doesn't seem to be a generic code. why do we hardcode here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to