fix(TablesPlot, v1.2): join selected columns with a comma to emit valid Python - #7004
Open
Yicong-Huang wants to merge 1 commit into
Open
Conversation
…hon (#6806) ### What changes were proposed in this PR? Fixes invalid generated Python in `TablesPlotOpDesc`. `getAttributes` built the selected-column list by joining the rendered column names with the literal `','`: ```scala private def getAttributes: String = includedColumns.map(c => pyb"""${c.attributeName}""").mkString("','") ``` used as `table.dropna(subset=[$attributes])` and `table[[$attributes]]`. Each `pyb"""${c.attributeName}"""` renders to a runtime-decoded call `self.decode_python_template('<base64>')`. Joining those with the literal `','` places a string literal immediately after a function call, which is a **Python SyntaxError**, so Tables Plot fails to run for any input: ```python table = table.dropna(subset=[self.decode_python_template('YQ==')','self.decode_python_template('Yg==')]) ``` (`YQ==`/`Yg==` decode to `a`/`b`.) **Fix:** join with a plain comma: ```diff - includedColumns.map(c => pyb"""${c.attributeName}""").mkString("','") + includedColumns.map(c => pyb"""${c.attributeName}""").mkString(",") ``` which yields the valid list: ```python subset=[self.decode_python_template('YQ=='),self.decode_python_template('Yg==')] ``` ### Any related issues, documentation, discussions? Closes #6791 ### How was this PR tested? Added a regression test to `TablesPlotOpDescSpec` that configures two columns, calls `generatePythonCode()`, and asserts: - the columns are comma-joined (`...('<b64>'),self.decode_python_template('<b64>')...`), and - the invalid `')','` sequence is absent. Both assertions fail on `main` and pass with this change. Ran the suite locally: ``` sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.visualization.tablesChart.TablesPlotOpDescSpec" ... Tests: succeeded 5, failed 0, canceled 0, ignored 0, pending 0 All tests passed. ``` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.8) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- (backported from commit 991608a) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.2 #7004 +/- ##
==================================================
- Coverage 53.95% 52.39% -1.56%
- Complexity 1441 2493 +1052
==================================================
Files 809 1077 +268
Lines 34144 42267 +8123
Branches 3448 4548 +1100
==================================================
+ Hits 18421 22145 +3724
- Misses 14815 18815 +4000
- Partials 908 1307 +399
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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?
Backport of #6806 to
release/v1.2, cherry-picked from 991608a.Source fix only. The test changes from #6806 were omitted: the touched test spec(s) do not exist on
release/v1.2(or depend on main-only test infrastructure), so backporting them cleanly is not possible. Only the source fix is carried over, per maintainer guidance.Any related issues, documentation, discussions?
Backport of #6806. Originally linked #6791.
How was this PR tested?
Release-branch CI runs on this PR. The source change cherry-picked cleanly; test changes were intentionally dropped (see above).
Was this PR authored or co-authored using generative AI tooling?
Yes — backport prepared with Claude Code (mechanical cherry-pick + conflict resolution; the change itself is #6806 by its original author).
🤖 Generated with Claude Code