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
implement builtin_string/instr_binary #4340
Conversation
Signed-off-by: TigerInYourDreams <TigerInYourDream@hi.zy>
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
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
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.
But LGTM anyway
match s.find(&substr) { | ||
Some(x) => Ok(Some(1 + s[..x].chars().count() as i64)), | ||
None => Ok(Some(0)), | ||
} |
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.
Can extract the Ok(Some(
part:
Ok(Some(match s.find(&substr) {
Some(x) => 1 + s[..x].chars().count() as i64,
None => 0,
}))
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 think no necessary.
("F", "abcdefg", 0), | ||
("cd", "abcdefg", 3), | ||
(" ", "abcdefg", 0), | ||
("", "", 0), |
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.
the result is 1
in mysql.
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.
@AndreMouche Thanks for the review.The same problem in #4337 .
This reverts commit 5a296bc.
row: &'a [Datum], | ||
) -> Result<Option<i64>> { | ||
let s = try_opt!(self.children[0].eval_string_and_decode(ctx, row)); | ||
let substr = try_opt!(self.children[1].eval_string_and_decode(ctx, row)); |
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 think we needn't decode it since it is a binary.
@TigerInYourDream Would you like to fix the bug? |
@AndreMouche My bad.I'll create new pr to fix it. Thanks for your help. |
Signed-off-by: TigerInYourDreams <TigerInYourDream@hi.zy>
Signed-off-by: TigerInYourDreams TigerInYourDream@hi.zy
What have you changed? (mandatory)
Implement the function instr_binary which I found in #3275
Please explain IN DETAIL what the changes are in this PR and why they are needed:
Add instr_binary function.
What are the type of the changes? (mandatory)
Add function。
The currently defined types are listed below, please pick one of the types for this PR by removing the others:
How has this PR been tested? (mandatory)
Unit Test。
Does this PR affect documentation (docs) update? (mandatory)
No.
Does this PR affect tidb-ansible update? (mandatory)
No