-
Notifications
You must be signed in to change notification settings - Fork 232
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
Fix test_unsupported_fallback_regexp_replace #10093
Merged
revans2
merged 4 commits into
NVIDIA:branch-24.02
from
thirtiseven:unsupported_fallback_regexp_replace
Dec 29, 2023
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 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
Oops, something went wrong.
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.
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.
So backslashes and dollar signs can cause issues for the replacement string in regexp_replace on the CPU, but we fall back to the CPU properly. So the problem is really just with the data that we generated for this one test. Why then are we getting rid of backslashes and dollar signs for
mk_str_gen
by default instead of targeting it specifically to just the replacement string forregexp_replace
?i.e. on line 942 we have the following instead.
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.
When
mk_str_gen
is used to generate regular expressions, the.with_special_pattern('.{0,10}')
in it sometimes generates valid or invalid regexps and fails some tests.For this issue, if adding some special cases (which can be generated by
'.{0,10}'
) in it:and run:
we will get:
So I think we can leave it by default in regexp_test for now, to at least avoid some random IT failures.
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.
And I think mk_str_gen is not very ideal when generating regex data, we might need a better way to generate random literal strings / valid regexps/ invalid regexps as test data.
filed #10098.
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.
Hi @thirtiseven
There could be a confusion here. Bobby's comment refers to the local var definition inside the test function
test_unsupported_fallback_regexp_replace
the diff should be something like
and I see 0 failures with this change for
-k regexp
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.
Thanks @gerashegalov
Making the datagen inside the test function makes sense to me and will fix the issue with no failures. I'm trying to explain why I think it might be a general issue when generating regexps with
mk_str_gen
.My step is modifying the
mk_str_gen
inside theregexp_test.py
file to add more special cases and run the-k regexp
.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.
But we don't generate regexps with
mk_str_gen
. Looking through regexp_test.py, every regexp I see is hard coded, except fortest_unsupported_fallback_regexp_extract
,test_unsupported_fallback_regexp_extract_all
, andtest_unsupported_fallback_regexp_replace
which do not usemk_str_gen
for the regexp. I don't see any gen_scalar* in there that would allow us to make a random scalar regular expression either. I think we should probably update those StringGens used to create the regular expressions so that they don't have any special cases in them. We don't need them to test what we are testing.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.
Sorry my bad, You are right, we don't generate regexps with mk_str_gen.
I tested with
with_special_pattern
in a wrong way.Closed the issue and updated this fix inside the case.