-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make LIKE predicate index aware #18289
Make LIKE predicate index aware #18289
Conversation
|
hazelcast/src/main/java/com/hazelcast/query/impl/predicates/LikePredicate.java
Outdated
Show resolved
Hide resolved
hazelcast/src/main/java/com/hazelcast/query/impl/predicates/LikePredicate.java
Outdated
Show resolved
Hide resolved
7e2695c
to
b105032
Compare
hazelcast/src/main/java/com/hazelcast/query/impl/predicates/LikePredicate.java
Outdated
Show resolved
Hide resolved
Looks like there are no tests targeting indexed |
The job Click to expand the log file-------------------------- -------TEST FAILURE------- -------------------------- [INFO] Results: [INFO] [ERROR] Errors: [ERROR] ConfiguredBehaviourTest.testReconnectModeASYNCSingleMemberStartLate:266 ? HazelcastClientOffline [INFO] [ERROR] Tests run: 36164, Failures: 0, Errors: 1, Skipped: 988 [INFO] |
Test failure is not related and filled in #18323 |
char c = expression.charAt(i); | ||
if (c == '\\') { | ||
escape = true; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I have an expression "\\%"
. Then the \
is actually escaping the second \
? But the algorithm will consider like it is escaping the %
symbol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch added tests and fixed
@Override | ||
public Set<QueryableEntry> filter(QueryContext queryContext) { | ||
Index index = queryContext.matchIndex(attributeName, QueryContext.IndexMatchHint.PREFER_ORDERED); | ||
String indexPrefix = expression.substring(0, expression.length() - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand we cut the %
here. But what if we have trailing whitespace? Is it possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if %
is not the last symbol in the expression it wouldn't be indexed, added tests https://github.com/hazelcast/hazelcast/pull/18289/files#diff-8b3c97074f4277303b021451ae7612b8de726a0aec157799b64d5673798b363aR144
Closes #14561