agingade commented on a change in pull request #6044:
URL: https://github.com/apache/geode/pull/6044#discussion_r582372036
##########
File path:
geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java
##########
@@ -349,6 +349,30 @@ private String getRegexPattern(String pattern) {
sb.append(ch);
}
break;
+ case '$': // replace with [$]
+ if (prevMetaChar) {
+ sb.append('\\');
+ sb.append('E');
+ prevMetaChar = false;
+ }
+
+ numConsecutiveBackSlash = 0;
+ for (int j = i - 1; j > -1; --j) {
+ if (pattern.charAt(j) == '\\') {
+ ++numConsecutiveBackSlash;
+ } else {
+ break;
+ }
+ }
+
+ // Check if the $ has a valid escape. Backtrack to check for \.
Review comment:
Why "$" needs to be escaped being a literal in like predicate value. The
special characters that are used in LIKE or "_", "%" and "\" these chars needs
to be escaped with escape char "\".
I think we should be able to compare the "$" literal within the like
predicate without escaping it. Please let me know if I am missing anything.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]