aglinxinyuan opened a new pull request, #9646:
URL: https://github.com/apache/texera/pull/9646

   ### What changes were proposed in this PR?
   
   Share duplicated runtime (`generatePythonCode`) and standalone 
(`generateStandaloneCode`) Plotly Python code generation across four 
visualization operators in `common/workflow-operator` (`4` files, `+364/-571`, 
`-207` net lines):
   
   | File | Shared codegen | Net LOC |
   | --- | --- | ---: |
   | `NetworkGraphOpDesc.scala` | Extracts `NetworkGraphPython.body(indent)` 
for graph construction, seeded `spring_layout`, edge/node traces, and figure 
layout | `+107/-181` (-74) |
   | `BulletChartOpDesc.scala` | Extracts `deltaReferenceLiteral`, 
`thresholdLiteral`, `stepsLiteral`, and `BulletChartPython` (`helperDefs`, 
`stepsListBody`, `figureBody`) | `+96/-136` (-40) |
   | `TreePlotOpDesc.scala` | Extracts `TreePlotPython.annotationsBody`, 
`parseEdges`, and `figureBody` (reusing `PythonCodeFragment.render`) | 
`+93/-134` (-41) |
   | `ContinuousErrorBandsOpDesc.scala` | Extracts `buildFigure(tableVar, 
encode, indent)` returning `PythonTemplateBuilder` so runtime 
`createPlotlyFigure()` preserves both `.plain` and `.encode` modes while 
standalone renders via `pyStringLiteral` | `+68/-120` (-52) |
   
   Notes for reviewers:
   - Runtime `pyb` base64 encoding (`self.decode_python_template(...)`) and 
standalone `pyStringLiteral` escaping are preserved unchanged.
   - No existing operator tests were modified; all user-facing behavior and 
error messages remain identical.
   
   ### Any related issues, documentation, discussions?
   
   Closes #9645
   
   ### How was this PR tested?
   
   Verified on `cd3fc253ee` (based on `origin/main` `95e2748b97`) with JDK 
17.0.14, `sbt 1.12.9`, and Python 3.12 (`pandas 2.2.3`, `plotly 5.24.1`, 
`networkx 3.4.2`):
   
   ```bash
   sbt "WorkflowOperator/scalafixAll --check" 
"WorkflowOperator/scalafmtCheckAll"
   UDF_PYTHON_PATH=/path/to/python3.12 sbt \
     "WorkflowOperator/testOnly *NetworkGraphOpDescSpec *BulletChartOpDescSpec 
*TreePlotOpDescSpec *ContinuousErrorBandsOpDescSpec *ColorPatternSpec" \
     "WorkflowCompilingService/testOnly *WorkflowToPythonTranslatorSpec"
   ```
   
   - **Lint / format:** `WorkflowOperator/scalafixAll --check` and 
`WorkflowOperator/scalafmtCheckAll` exit `0`.
   - **Unit tests (JUnit XML):**
     - `WorkflowOperator`: `5` suites, `100` cases (`99` passed, `1` 
pre-existing `pendingUntilFixed` skipped in `BulletChartOpDescSpec`, `0` 
failed), including all `5` live `NeedsPythonPackages` layout tests in 
`TreePlotOpDescSpec`.
     - `WorkflowCompilingService`: `WorkflowToPythonTranslatorSpec` `19/19` 
passed.
   - **Live Python parity:** Executed generated runtime (`generatePythonCode`) 
and standalone (`generateStandaloneCode`) scripts for all four operators in 
Python 3.12 against `origin/main` `95e2748b97`: `8/8` Plotly figure JSON 
outputs matched identically, and 
`ContinuousErrorBandsOpDesc.createPlotlyFigure()` preserved literal column 
names under `.plain` and base64 decode expressions under `.encode`.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Antigravity
   


-- 
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]

Reply via email to