-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: regex simplification of anchored patterns produces wrong results #22727
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,12 +204,65 @@ SELECT * FROM test WHERE column1 ~ 'z' | |
| ---- | ||
| Bazzz | ||
|
|
||
| query T | ||
| SELECT * FROM test WHERE column1 ~ '^Bazzz$' | ||
| ---- | ||
| Bazzz | ||
|
|
||
| query T | ||
| SELECT * FROM test WHERE column1 ~ '^(foo|Bazzz)$' | ||
| ---- | ||
| foo | ||
| Bazzz | ||
|
|
||
| statement ok | ||
| CREATE TABLE test_regex_utf8view(s VARCHAR) AS VALUES ('foo'), ('Bazzz'); | ||
|
|
||
| query T | ||
| SELECT * FROM test_regex_utf8view WHERE s ~ '^Bazzz$' | ||
| ---- | ||
| Bazzz | ||
|
|
||
| query T | ||
| SELECT * FROM test_regex_utf8view WHERE s ~ '^(foo|Bazzz)$' | ||
| ---- | ||
| foo | ||
| Bazzz | ||
|
|
||
| # Case-insensitive anchored match over Utf8View: must be simplified to ILIKE | ||
| # (not a case-sensitive Eq) and must keep operand types as Utf8View. | ||
| query T | ||
| SELECT * FROM test_regex_utf8view WHERE s ~* '^bazzz$' | ||
| ---- | ||
| Bazzz | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How this asserts the expected result ? |
||
|
|
||
| # Case-insensitive anchored alternation over Utf8View | ||
| query T rowsort | ||
| SELECT * FROM test_regex_utf8view WHERE s ~* '^(foo|bazzz)$' | ||
| ---- | ||
| Bazzz | ||
| foo | ||
|
|
||
| statement ok | ||
| DROP TABLE test_regex_utf8view; | ||
|
|
||
| query T | ||
| SELECT * FROM test WHERE column1 ~* 'z' | ||
| ---- | ||
| Bazzz | ||
| ZZZZZ | ||
|
|
||
| query T | ||
| SELECT * FROM test WHERE column1 ~* '^barrr$' | ||
| ---- | ||
| Barrr | ||
|
|
||
| query T | ||
| SELECT * FROM test WHERE column1 ~* '^(barrr|bazzz)$' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests with negation+regex are missing ( |
||
| ---- | ||
| Barrr | ||
| Bazzz | ||
|
|
||
| query T | ||
| SELECT * FROM test WHERE column1 !~ 'z' | ||
| ---- | ||
|
|
||
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.
Question to educate myself: How the values here are Utf8View ?
I'd expect some casting to achieve that.