kz930 opened a new pull request, #6806:
URL: https://github.com/apache/texera/pull/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)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]