fix(operator): correct regex escaping in WordCloud operator#4261
Merged
bobbai00 merged 4 commits intoapache:mainfrom Mar 6, 2026
Merged
fix(operator): correct regex escaping in WordCloud operator#4261bobbai00 merged 4 commits intoapache:mainfrom
bobbai00 merged 4 commits intoapache:mainfrom
Conversation
The regex pattern `r'\\w'` in the Scala triple-quoted string produced `r'\\w'` in Python, which matches a literal backslash + 'w' instead of word characters. This caused `str.contains` to filter out all rows, resulting in "text column does not contain words or contains only nulls". Also removed a duplicate Map statement in getOutputSchemas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chenlica
reviewed
Mar 5, 2026
...rc/main/scala/org/apache/texera/amber/operator/visualization/wordCloud/WordCloudOpDesc.scala
Show resolved
Hide resolved
Verify that manipulateTable() uses r'\w' (word character match) instead of r'\\w' (literal backslash+w match). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chenlica
approved these changes
Mar 5, 2026
Contributor
chenlica
left a comment
There was a problem hiding this comment.
LGTM now (after adding the test case).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this PR?
Fixed two issues in
WordCloudOpDesc.scala:Regex escaping bug: The
pybrefactor in feat(backend): introduce python code template builder for creating Python based operators #4189 changedmanipulateTable()froms"..."topyb"""...""", but the regex\\wwas not adjusted. Ins"...",\\wis an escape sequence producing\w. In triple-quotedpyb"""...""", backslashes are literal, so\\wstays as\\w— producingr'\\w'in Python, which matches a literal backslash +winstead of word characters. This caused all rows to be filtered out, resulting in: "text column does not contain words or contains only nulls." Fixed by changing to\w.Duplicate statement: Removed a duplicate
Map(...)line ingetOutputSchemas.Added unit tests to verify the regex pattern is correct.
Any related issues, documentation, discussions?
Regression introduced by #4189.
How was this PR tested?
Added
WordCloudOpDescSpecwith tests that verify:manipulateTable()usesr'\w'(notr'\\w')All tests pass.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.6)