deniskuzZ commented on code in PR #4998:
URL: https://github.com/apache/hive/pull/4998#discussion_r1535772006
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStringColLikeStringScalar.java:
##########
@@ -140,4 +133,84 @@ public Checker tryCreate(String pattern) {
return new ComplexChecker("^" + UDFLike.likePatternToRegExp(pattern) +
"$");
}
}
+
+ /**
+ * Check the LIKE pattern..
+ */
+ private static class CheckerPattern {
+ private final String pattern;
+ private final UDFLike.PatternType type;
+
+ public CheckerPattern(UDFLike.PatternType type, String pattern) {
+ this.type = type;
+ this.pattern = pattern;
+ }
+
+ public String check() {
+ UDFLike.PatternType lastType = UDFLike.PatternType.NONE;
+ int length = pattern.length();
+ int beginIndex = 0;
+ int endIndex = length;
+ char lastChar = 0;
+ String strPattern = new String();
+ String simplePattern;
+
+ for (int i = 0; i < length; i++) {
Review Comment:
👍, do we have any benchmarks that prove efficiency of implemented algorithm?
also, usually for such kind of tasks (pattern matching) state machines are one
of the recommended techniques.
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStringColLikeStringScalar.java:
##########
@@ -140,4 +133,84 @@ public Checker tryCreate(String pattern) {
return new ComplexChecker("^" + UDFLike.likePatternToRegExp(pattern) +
"$");
}
}
+
+ /**
+ * Check the LIKE pattern..
+ */
+ private static class CheckerPattern {
+ private final String pattern;
+ private final UDFLike.PatternType type;
+
+ public CheckerPattern(UDFLike.PatternType type, String pattern) {
+ this.type = type;
+ this.pattern = pattern;
+ }
+
+ public String check() {
+ UDFLike.PatternType lastType = UDFLike.PatternType.NONE;
+ int length = pattern.length();
+ int beginIndex = 0;
+ int endIndex = length;
+ char lastChar = 0;
+ String strPattern = new String();
+ String simplePattern;
+
+ for (int i = 0; i < length; i++) {
Review Comment:
👍, do we have any benchmarks that prove efficiency of implemented algorithm?
also, usually for such kind of tasks (pattern matching) state machines is one
of the recommended techniques.
--
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]