fix(TablesPlot): join selected columns with a comma to emit valid Python#6806
Conversation
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6806 +/- ##
============================================
- Coverage 75.41% 75.41% -0.01%
+ Complexity 3452 3451 -1
============================================
Files 1160 1160
Lines 45807 45806 -1
Branches 5071 5071
============================================
- Hits 34544 34543 -1
Misses 9657 9657
Partials 1606 1606
*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:
|
✅ No material benchmark regressions detected🟢 5 better · 🔴 0 worse · ⚪ 10 noise (<±5%) · 0 without baseline
Baseline detailsLatest main
Raw CSVconfig_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,535.76,200,128000,373,0.228,24602.44,36529.47,36529.47
1,100,10,64,20,2531.11,2000,1280000,790,0.482,122966.68,155972.50,155972.50
2,1000,10,64,20,21909.93,20000,12800000,913,0.557,1096424.60,1125197.30,1125197.30 |
getAttributes joined the rendered column names with the literal ',', but each
column renders to a decode_python_template(...) call. Joining calls with a string
literal produced invalid Python (a call immediately followed by a string):
subset=[self.decode_python_template('YQ==')','self.decode_python_template('Yg==')]
so Tables Plot failed with a SyntaxError for any input. Joining with a plain comma
yields a valid list:
subset=[self.decode_python_template('YQ=='),self.decode_python_template('Yg==')]
Added a regression test asserting the columns are comma-joined and the invalid
')',' sequence is absent.
Closes apache#6791
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1a16666 to
ab92ab2
Compare
|
@eugenegujing May you take a look at it please? |
There was a problem hiding this comment.
Pull request overview
This PR fixes invalid Python code generation in the Tables Plot visualization operator (TablesPlotOpDesc) by correcting how selected column names are concatenated into Python list literals. This ensures the generated dropna(subset=[...]) and table[[...]] expressions are syntactically valid when multiple columns are selected.
Changes:
- Change
getAttributesto join per-columnpybrenderings with","instead of the literal"','", avoidingSyntaxErrorin generated Python. - Add a regression test asserting multi-column selection produces comma-joined
decode_python_template(...)calls and does not contain the invalid')','sequence.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/tablesChart/TablesPlotOpDesc.scala | Fix Python attribute-list concatenation to emit valid Python when multiple columns are selected. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/tablesChart/TablesPlotOpDescSpec.scala | Add regression coverage for the multi-column comma-join behavior in generated Python. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Please fix the format of the file. |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Done — the assertion line exceeded the 100-column limit; wrapped it so |
What changes were proposed in this PR?
Fixes invalid generated Python in
TablesPlotOpDesc.getAttributesbuilt the selected-column list by joining the rendered column names with the literal',':used as
table.dropna(subset=[$attributes])andtable[[$attributes]].Each
pyb"""${c.attributeName}"""renders to a runtime-decoded callself.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:(
YQ==/Yg==decode toa/b.)Fix: join with a plain comma:
which yields the valid list:
Any related issues, documentation, discussions?
Closes #6791
How was this PR tested?
Added a regression test to
TablesPlotOpDescSpecthat configures two columns, callsgeneratePythonCode(), and asserts:...('<b64>'),self.decode_python_template('<b64>')...), and')','sequence is absent.Both assertions fail on
mainand pass with this change.Ran the suite locally:
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)
🤖 Generated with Claude Code