-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](like) fix wrong result of like pattern with backslash #18039
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
Conversation
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
TeamCity pipeline, clickbench performance test result: |
|
clang-tidy review says "All clean, LGTM! 👍" |
xiaokang
left a comment
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
|
PR approved by anyone and no changes requested. |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
run buildall |
yiguolei
left a comment
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
|
PR approved by at least one committer and no changes requested. |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
run buildall |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
yiguolei
left a comment
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
…8039) Result is empty for query select * from person where address like '%\\\\%';, but MySQL can get a line of result. CREATE TABLE `person` ( `id` int(11) NULL, `name` text NULL, `age` int(11) NULL, `class` int(11) NULL, `address` text NULL ) ENGINE=OLAP UNIQUE KEY(`id`) COMMENT 'OLAP' DISTRIBUTED BY HASH(`id`) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2", "disable_auto_compaction" = "false" ); insert into person values (10001,'test1',30,2,'test\\\\,xxx'); Adding logs: select * from person where address like '%\\\\%'; I0323 10:26:15.907760 2387043 like.cpp:558] arg str: %\\%, size: 4, pattern LIKE_ENDS_WITH_RE: (?:%+)(((\\%)|(\\_)|([^%_]))+), size: 30 I0323 10:26:15.907789 2387043 like.cpp:562] match 0: \\%, size: 3 I0323 10:26:15.907801 2387043 like.cpp:562] match 1: \%, size: 2 I0323 10:26:15.907811 2387043 like.cpp:562] match 2: \%, size: 2 I0323 10:26:15.907821 2387043 like.cpp:562] match 3: , size: 0 I0323 10:26:15.907830 2387043 like.cpp:562] match 4: \, size: 1 I0323 10:26:15.907842 2387043 like.cpp:615] search_string : \\% I0323 10:26:15.907855 2387043 like.cpp:619] search_string escape removed: \% It matchs against the LIKE_ENDS_WITH_RE which is wrong, the meaning of the sql should be: match strings that have one backslash in any place.
…8039) Result is empty for query select * from person where address like '%\\\\%';, but MySQL can get a line of result. CREATE TABLE `person` ( `id` int(11) NULL, `name` text NULL, `age` int(11) NULL, `class` int(11) NULL, `address` text NULL ) ENGINE=OLAP UNIQUE KEY(`id`) COMMENT 'OLAP' DISTRIBUTED BY HASH(`id`) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2", "disable_auto_compaction" = "false" ); insert into person values (10001,'test1',30,2,'test\\\\,xxx'); Adding logs: select * from person where address like '%\\\\%'; I0323 10:26:15.907760 2387043 like.cpp:558] arg str: %\\%, size: 4, pattern LIKE_ENDS_WITH_RE: (?:%+)(((\\%)|(\\_)|([^%_]))+), size: 30 I0323 10:26:15.907789 2387043 like.cpp:562] match 0: \\%, size: 3 I0323 10:26:15.907801 2387043 like.cpp:562] match 1: \%, size: 2 I0323 10:26:15.907811 2387043 like.cpp:562] match 2: \%, size: 2 I0323 10:26:15.907821 2387043 like.cpp:562] match 3: , size: 0 I0323 10:26:15.907830 2387043 like.cpp:562] match 4: \, size: 1 I0323 10:26:15.907842 2387043 like.cpp:615] search_string : \\% I0323 10:26:15.907855 2387043 like.cpp:619] search_string escape removed: \% It matchs against the LIKE_ENDS_WITH_RE which is wrong, the meaning of the sql should be: match strings that have one backslash in any place.
…8039) Result is empty for query select * from person where address like '%\\\\%';, but MySQL can get a line of result. CREATE TABLE `person` ( `id` int(11) NULL, `name` text NULL, `age` int(11) NULL, `class` int(11) NULL, `address` text NULL ) ENGINE=OLAP UNIQUE KEY(`id`) COMMENT 'OLAP' DISTRIBUTED BY HASH(`id`) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2", "disable_auto_compaction" = "false" ); insert into person values (10001,'test1',30,2,'test\\\\,xxx'); Adding logs: select * from person where address like '%\\\\%'; I0323 10:26:15.907760 2387043 like.cpp:558] arg str: %\\%, size: 4, pattern LIKE_ENDS_WITH_RE: (?:%+)(((\\%)|(\\_)|([^%_]))+), size: 30 I0323 10:26:15.907789 2387043 like.cpp:562] match 0: \\%, size: 3 I0323 10:26:15.907801 2387043 like.cpp:562] match 1: \%, size: 2 I0323 10:26:15.907811 2387043 like.cpp:562] match 2: \%, size: 2 I0323 10:26:15.907821 2387043 like.cpp:562] match 3: , size: 0 I0323 10:26:15.907830 2387043 like.cpp:562] match 4: \, size: 1 I0323 10:26:15.907842 2387043 like.cpp:615] search_string : \\% I0323 10:26:15.907855 2387043 like.cpp:619] search_string escape removed: \% It matchs against the LIKE_ENDS_WITH_RE which is wrong, the meaning of the sql should be: match strings that have one backslash in any place.
…8039) Result is empty for query select * from person where address like '%\\\\%';, but MySQL can get a line of result. CREATE TABLE `person` ( `id` int(11) NULL, `name` text NULL, `age` int(11) NULL, `class` int(11) NULL, `address` text NULL ) ENGINE=OLAP UNIQUE KEY(`id`) COMMENT 'OLAP' DISTRIBUTED BY HASH(`id`) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2", "disable_auto_compaction" = "false" ); insert into person values (10001,'test1',30,2,'test\\\\,xxx'); Adding logs: select * from person where address like '%\\\\%'; I0323 10:26:15.907760 2387043 like.cpp:558] arg str: %\\%, size: 4, pattern LIKE_ENDS_WITH_RE: (?:%+)(((\\%)|(\\_)|([^%_]))+), size: 30 I0323 10:26:15.907789 2387043 like.cpp:562] match 0: \\%, size: 3 I0323 10:26:15.907801 2387043 like.cpp:562] match 1: \%, size: 2 I0323 10:26:15.907811 2387043 like.cpp:562] match 2: \%, size: 2 I0323 10:26:15.907821 2387043 like.cpp:562] match 3: , size: 0 I0323 10:26:15.907830 2387043 like.cpp:562] match 4: \, size: 1 I0323 10:26:15.907842 2387043 like.cpp:615] search_string : \\% I0323 10:26:15.907855 2387043 like.cpp:619] search_string escape removed: \% It matchs against the LIKE_ENDS_WITH_RE which is wrong, the meaning of the sql should be: match strings that have one backslash in any place.
Proposed changes
Issue Number: close #xxx
Problem summary
Result is empty for query
select * from person where address like '%\\\\%';, but MySQL can get a line of result.Adding logs:
It matchs against the LIKE_ENDS_WITH_RE which is wrong, the meaning of the sql should be: match strings that have one backslash in any place.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...