-
Notifications
You must be signed in to change notification settings - Fork 415
feat: support function unhex pushdown #5686
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
afe1bb3
feat: support function unhex pushdown
b41sh 3b6f111
Merge branch 'master' into func-unhex
b41sh 343cd8f
format
b41sh 3e6cd8e
merge
b41sh 760eea4
fix test
b41sh a6f489a
Merge branch 'master' into func-unhex
b41sh 51e507e
fix test
b41sh 121a8ce
Merge branch 'master' into func-unhex
b41sh 692013f
fix
b41sh a0aeaf9
Merge branch 'func-unhex' of https://github.com/b41sh/tiflash into fu…
b41sh 66a2b66
format
b41sh 148d7fb
tidy
b41sh 2acc88d
fix
b41sh 5bcca80
remove int implement
b41sh bdac5ca
Merge branch 'master' into func-unhex
b41sh d3c3bfc
Merge branch 'master' into func-unhex
b41sh 5eaf750
Merge branch 'master' into func-unhex
b41sh 505d095
fix
b41sh 2817440
Merge branch 'master' into func-unhex
b41sh ef48422
Merge branch 'master' into func-unhex
b41sh 6932932
Merge branch 'master' into func-unhex
mengxin9014 38773b6
Merge branch 'master' into func-unhex
b41sh 857819b
add tests
b41sh d3c4ac5
Merge branch 'master' into func-unhex
b41sh 496855d
Merge branch 'master' into func-unhex
SeaRise 887b308
Merge branch 'master' into func-unhex
b41sh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // Copyright 2022 PingCAP, Ltd. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include <DataTypes/DataTypeNullable.h> | ||
| #include <TestUtils/FunctionTestUtils.h> | ||
| #include <TestUtils/TiFlashTestBasic.h> | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
|
|
||
| namespace DB | ||
| { | ||
| namespace tests | ||
| { | ||
| class UnHexTest : public DB::tests::FunctionTest | ||
| { | ||
| }; | ||
|
|
||
| TEST_F(UnHexTest, unhexAllUnitTest) | ||
| try | ||
| { | ||
| const String & func_name = "tidbUnHex"; | ||
|
|
||
| ASSERT_COLUMN_EQ( | ||
| createColumn<Nullable<String>>({"www.pingcap.com", "abcd", std::nullopt, std::nullopt, ""}), | ||
| executeFunction( | ||
| func_name, | ||
| createColumn<Nullable<String>>({"7777772E70696E676361702E636F6D", "61626364", std::nullopt, "GG", ""}))); | ||
|
|
||
| ASSERT_COLUMN_EQ( | ||
| createColumn<Nullable<String>>({"ѐёђѓєѕіїјЉЊЋЌЍЎЏ", "+ѐ-ё*ђ/ѓ!є@ѕ#і$@ї%ј……Љ&Њ(Ћ)Ќ¥Ѝ#Ў@Џ!^", "αβγδεζηθικλμνξοπρστυφχψως", "▲α▼βγ➨δε☎ζη✂θι€κλ♫μν✓ξο✚πρ℉στ♥υφ♖χψ♘ω★ς✕", "թփձջրչճժծքոեռտըւիօպասդֆգհյկլխզղցվբնմշ"}), | ||
| executeFunction( | ||
| func_name, | ||
| createColumn<String>({"d190d191d192d193d194d195d196d197d198d089d08ad08bd08cd08dd08ed08f", | ||
| "2bd1902dd1912ad1922fd19321d19440d19523d1962440d19725d198e280a6e280a6d08926d08aefbc88d08befbc89d08cefbfa5d08d23d08e40d08fefbc815e", | ||
| "ceb1ceb2ceb3ceb4ceb5ceb6ceb7ceb8ceb9cebacebbcebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89cf82", | ||
| "e296b2ceb1e296bcceb2ceb3e29ea8ceb4ceb5e2988eceb6ceb7e29c82ceb8ceb9e282accebacebbe299abcebccebde29c93cebecebfe29c9acf80cf81e28489cf83cf84e299a5cf85cf86e29996cf87cf88e29998cf89e29885cf82e29c95", | ||
| "d5a9d683d5b1d5bbd680d5b9d5b3d5aad5aed684d5b8d5a5d5bcd5bfd5a8d682d5abd685d5bad5a1d5bdd5a4d686d5a3d5b0d5b5d5afd5acd5add5a6d5b2d681d5bed5a2d5b6d5b4d5b7"}))); | ||
|
|
||
| // CJK and emoji | ||
| ASSERT_COLUMN_EQ( | ||
| createColumn<Nullable<String>>({"さらに入", "测试测试测试测试abcd测试", "🍻", "🏴☠️"}), | ||
| executeFunction( | ||
| func_name, | ||
| createColumn<Nullable<String>>({"E38195E38289E381ABE585A5", "E6B58BE8AF95E6B58BE8AF95E6B58BE8AF95E6B58BE8AF9561626364E6B58BE8AF95", "F09F8DBB", "F09F8FB4E2808DE298A0EFB88F"}))); | ||
|
|
||
| // Special Empty Character | ||
| ASSERT_COLUMN_EQ( | ||
| createColumn<Nullable<String>>({"\t", "\t", "\n", "\n", " "}), | ||
| executeFunction( | ||
| func_name, | ||
| createColumn<Nullable<String>>({"9", "09", "A", "0A", "20"}))); | ||
|
|
||
| // Const Column | ||
| ASSERT_COLUMN_EQ( | ||
| createConstColumn<Nullable<String>>(4, "ab"), | ||
| executeFunction( | ||
| func_name, | ||
| createConstColumn<String>(4, "6162"))); | ||
| } | ||
|
ywqzzy marked this conversation as resolved.
ywqzzy marked this conversation as resolved.
|
||
| CATCH | ||
| } // namespace tests | ||
| } // namespace DB | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Copyright 2022 PingCAP, Ltd. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| mysql> drop table if exists test.t; | ||
| mysql> create table if not exists test.t(a char(100), b int); | ||
|
|
||
| mysql> insert into test.t values('7777772E70696E676361702E636F6D', 3039); | ||
| mysql> insert into test.t values('61626364', 61626364); | ||
| mysql> insert into test.t values('GG', -1); | ||
| mysql> insert into test.t values('E38195E38289E381ABE585A5', 313233); | ||
| mysql> insert into test.t values('F09F8DBB', 414243); | ||
| mysql> alter table test.t set tiflash replica 1; | ||
|
b41sh marked this conversation as resolved.
|
||
| func> wait_table test t | ||
|
|
||
| mysql> set tidb_enforce_mpp=1; set tidb_isolation_read_engines='tiflash'; select unhex(a), unhex(b) from test.t; | ||
| +-----------------+----------+ | ||
| | unhex(a) | unhex(b) | | ||
| +-----------------+----------+ | ||
| | www.pingcap.com | 09 | | ||
| | abcd | abcd | | ||
| | NULL | NULL | | ||
| | さらに入 | 123 | | ||
| | 🍻 | ABC | | ||
| +-----------------+----------+ | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.