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

feat(expr):support is_ipv4 and is_ipv6 expr to tiflash #6773

Merged
merged 50 commits into from
Feb 15, 2023
Merged

feat(expr):support is_ipv4 and is_ipv6 expr to tiflash #6773

merged 50 commits into from
Feb 15, 2023

Conversation

AntiTopQuark
Copy link
Contributor

@AntiTopQuark AntiTopQuark commented Feb 7, 2023

pushdown to tiflash

What problem does this PR solve?

Issue Number: close #5120
close #5121

Problem Summary:
support is_ipv4() and is_ipv6() expr to pushdown to tiflash

What is changed and how it works?

  1. register the cast function
  2. implement the calculation for is_ipv4() and is_ipv6()
  3. add tests of functions

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

support is_ipv4() and is_ipv6() expr to pushdown to tiflash

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 7, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Lloyd-Pottiger
  • ywqzzy

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 7, 2023
@AntiTopQuark AntiTopQuark changed the title feat(expr):support is_ipv4 and is_ipv6 expr to feat(expr):support is_ipv4 and is_ipv6 expr to tiflash Feb 7, 2023
@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

@AntiTopQuark
Copy link
Contributor Author

/cc @JaySon-Huang
/cc @CalvinNeo

@Lloyd-Pottiger
Copy link
Contributor

/cc @ywqzzy @xzhangxian1008

dbms/src/Functions/FunctionsIsIPAddr.h Outdated Show resolved Hide resolved
dbms/src/Functions/FunctionsIsIPAddr.h Outdated Show resolved Hide resolved
dbms/src/Functions/FunctionsIsIPAddr.h Outdated Show resolved Hide resolved
@ywqzzy ywqzzy self-requested a review February 8, 2023 07:37
dbms/src/Functions/FunctionsIsIPAddr.h Outdated Show resolved Hide resolved
dbms/src/Functions/FunctionsIsIPAddr.h Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 14, 2023
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 14, 2023
@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@SeaRise SeaRise left a comment

Choose a reason for hiding this comment

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

good job! Others LGTM

void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) const override
{
auto [column, nullmap] = removeNullable(block.getByPosition(arguments[0]).column.get());
if (const auto * col_input = checkAndGetColumn<ColumnString>(column))
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this hold true for the case where the input is only null?
Is there an ut to guarantee this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank u very much~

Before there was a test case where the input was all NULL for testing ConstColumn
https://github.com/AntiTopQuark/support_ipv4_and_ipv6_func/blob/09fd7fd29c83f298ee654c9b9a416601a718b854/dbms/src/Functions/tests/gtest_is_ip_addr.cpp#L80

    ASSERT_COLUMN_EQ(createConstColumn<UInt8>(4, 0), executeFunction("tiDBIsIPv6", {createConstColumn<Nullable<String>>(4, std::nullopt)}));

now I added another one

    ASSERT_COLUMN_EQ(createColumn<UInt8>({0, 0, 0, 0, 0}), executeFunction("tiDBIsIPv6", {createColumn<Nullable<String>>({std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt})}));

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you test for DataTypeNullable<DataTypeNothing>?
You can use

ColumnWithTypeAndName createOnlyNullColumnConst(size_t size, const String & name = "");
ColumnWithTypeAndName createOnlyNullColumn(size_t size, const String & name = "");

in FunctionTestUtils.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can refer to gtest_strings_concat_ws.cpp

@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 14, 2023
@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

1 similar comment
@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

@AntiTopQuark
Copy link
Contributor Author

/run-all-tests

@Lloyd-Pottiger
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@Lloyd-Pottiger: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 32cef30

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement IsIPv6 function push down Implement IsIPv4 function push down
6 participants