Skip to content
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

expr/builtin_fncall: implement Inet6Aton #3480

Merged
merged 4 commits into from Aug 24, 2018

Conversation

sweetIan
Copy link
Contributor

Signed-off-by: sweetIan ian.d2d@qq.com

What have you changed? (mandatory)

expr/builtin_fncall: implement Inet6Aton

What are the type of the changes? (mandatory)

  • New feature (non-breaking change which adds functionality)

How has this PR been tested? (mandatory)

unit test

Does this PR affect documentation (docs/docs-cn) update? (mandatory)

no

Does this PR affect tidb-ansible update? (mandatory)

no

Refer to a related PR or issue link (optional)

#3275

Signed-off-by: sweetIan <ian.d2d@qq.com>
@sre-bot
Copy link
Contributor

sre-bot commented Aug 19, 2018

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.

let input = try_opt!(self.children[0].eval_string_and_decode(ctx, row));
let ipv6_addr = Ipv6Addr::from_str(&input).map(|t| Some(Cow::Owned(t.octets().to_vec())));
let ipv4_addr = Ipv4Addr::from_str(&input).map(|t| Some(Cow::Owned(t.octets().to_vec())));
ipv6_addr.or(ipv4_addr).or(Ok(None))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use or_else instead of or.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hicqu Do you mean that we need to lazy evaluate ipv4_addr? How about write it as below?

let input = try_opt!(self.children[0].eval_string_and_decode(ctx, row));
let ipv6_addr = Ipv6Addr::from_str(&input).map(|t| Some(Cow::Owned(t.octets().to_vec())));
let ipv4_addr_eval =
     |_t| Ipv4Addr::from_str(&input).map(|t| Some(Cow::Owned(t.octets().to_vec())));
ipv6_addr.or_else(ipv4_addr_eval).or(Ok(None))

@hicqu
Copy link
Contributor

hicqu commented Aug 20, 2018

rest LGTM. PTAL @breeswish .

Signed-off-by: sweetIan <ian.d2d@qq.com>
@hicqu
Copy link
Contributor

hicqu commented Aug 21, 2018

LGTM.

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@huachaohuang huachaohuang added the status/LGT2 Status: PR - There are already 2 approvals label Aug 24, 2018
@Connor1996 Connor1996 merged commit bc2641b into tikv:master Aug 24, 2018
sticnarf pushed a commit to sticnarf/tikv that referenced this pull request Oct 27, 2019
Signed-off-by: sweetIan <ian.d2d@qq.com>
@sre-bot sre-bot added the contribution Type: PR - From contributors label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution Type: PR - From contributors status/LGT2 Status: PR - There are already 2 approvals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants