Skip to content

fix(TablesPlot, v1.2): join selected columns with a comma to emit valid Python - #7004

Open
Yicong-Huang wants to merge 1 commit into
release/v1.2from
backport/6806-join-selected-columns-with-a-comma-to-em-v1.2
Open

fix(TablesPlot, v1.2): join selected columns with a comma to emit valid Python #7004
Yicong-Huang wants to merge 1 commit into
release/v1.2from
backport/6806-join-selected-columns-with-a-comma-to-em-v1.2

Conversation

@Yicong-Huang

Copy link
Copy Markdown
Contributor

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

…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>
@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Jul 29, 2026
@Yicong-Huang
Yicong-Huang requested a review from xuang7 July 29, 2026 04:30
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @aglinxinyuan
    You can notify them by mentioning @aglinxinyuan in a comment.

@Yicong-Huang Yicong-Huang removed the release/v1.2 back porting to release/v1.2 label Jul 29, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.39%. Comparing base (fd5f487) to head (19065e1).
⚠️ Report is 2 commits behind head on release/v1.2.
✅ All tests successful. No failed tests found.

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     
Flag Coverage Δ *Carryforward flag
access-control-service 64.61% <ø> (ø)
agent-service 34.36% <ø> (ø) Carriedforward from fd5f487
amber 52.52% <100.00%> (-7.09%) ⬇️
computing-unit-managing-service 1.65% <ø> (ø)
config-service 56.06% <ø> (ø)
file-service 58.59% <ø> (ø)
frontend 47.19% <ø> (ø) Carriedforward from fd5f487
pyamber 90.87% <ø> (ø) Carriedforward from fd5f487
python 90.74% <ø> (ø) Carriedforward from fd5f487
workflow-compiling-service 58.69% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants