-
Notifications
You must be signed in to change notification settings - Fork 247
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
Fix prefix length is larger than the value used. #668
Conversation
} else if (val instanceof String) { | ||
return ((String) val).substring(0, prefixLength).getBytes(StandardCharsets.UTF_8); | ||
return ((String) val).substring(0, Math.min(((String) val).length(), prefixLength)) |
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.
String valStr = (String)val;
valStr.substring(0, Math.min(valStr.length(), prefixLength))
Make it clean.
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.
done
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.
LGTM as long as comment addressed.
@@ -57,6 +57,7 @@ class PrefixIndexTestSuite extends BaseTiSparkSuite { | |||
explainAndRunTest("select a, b from prefix where b LIKE 'ÿ%'", skipJDBC = true) | |||
explainAndRunTest("select a, b from prefix where b LIKE '%b'") | |||
explainAndRunTest("select a, b from prefix where b LIKE '%'") | |||
explainAndRunTest("select * from prefix where b = 'b'") |
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.
I purpose to move this line to Line 38 and add issue link.
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.
LGTM as long as comments resolved.
With the following schema:
the query
select * from idx where c_id == 'dairy'
will fail. This pr fixes this.