The GitHub Actions job "Required Checks" on 
texera.git/backport/6806-join-selected-columns-with-a-comma-to-em-v1.2 has 
succeeded.
Run started by GitHub user Yicong-Huang (triggered by Yicong-Huang).

Head commit for run:
19065e10f6c61c201ea32cecb222b4d3717d743c / Kary Zheng 
<[email protected]>
fix(TablesPlot): join selected columns with a comma to emit valid Python (#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 991608a3ad41a21fbd4a32cc981ac95be26b958a)

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/30422478812

With regards,
GitHub Actions via GitBox

Reply via email to