test(workflow-operator): add unit test coverage for visualization operator descriptors - #5827
Conversation
…rator descriptors Pin behavior of three previously-untested visualization descriptors: - HtmlVizOpDesc: operatorInfo (HTML Visualizer, VISUALIZATION_MEDIA_GROUP); wires HtmlVizOpExec; schema propagation emits a single html-content STRING column; htmlContentAttrName default - CandlestickChartOpDesc: operatorInfo (Candlestick Chart, VISUALIZATION_FINANCIAL_GROUP); getOutputSchemas html-content STRING; OHLC field defaults; generatePythonCode emits a Plotly Candlestick figure; field round-trip - Histogram2DOpDesc: operatorInfo (Histogram2D, VISUALIZATION_STATISTICAL_GROUP); getOutputSchemas html-content STRING; defaults (xBins/yBins=10, normalize=DENSITY); generatePythonCode rejects a non-positive bin count; field round-trip getPhysicalOp tests (HtmlViz) assert port IDENTITIES (keySet) rather than counts. 15 new tests; scalafmtCheck + scalafixAll --check clean; no production-code changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5827 +/- ##
============================================
+ Coverage 53.44% 53.58% +0.14%
- Complexity 2710 2727 +17
============================================
Files 1099 1099
Lines 42541 42541
Branches 4577 4577
============================================
+ Hits 22735 22796 +61
+ Misses 18474 18410 -64
- Partials 1332 1335 +3
*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:
|
There was a problem hiding this comment.
Pull request overview
Adds ScalaTest unit coverage for three previously untested visualization operator descriptors under common/workflow-operator/, pinning their public contracts (operator metadata, output schema, codegen guards, and JSON round-trip) without modifying production code.
Changes:
- Introduce
HtmlVizOpDescSpeccovering operatorInfo, physical wiring, and schema propagation. - Introduce
CandlestickChartOpDescSpeccovering defaults, output schema, codegen smoke assertions, and JSON polymorphic round-trip. - Introduce
Histogram2DOpDescSpeccovering defaults, output schema, codegen guard for invalid bins, and JSON polymorphic round-trip.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/htmlviz/HtmlVizOpDescSpec.scala | Adds unit tests for HtmlViz descriptor metadata, physical-op wiring, and schema propagation. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/candlestickChart/CandlestickChartOpDescSpec.scala | Adds unit tests for Candlestick descriptor metadata, defaults, output schema, codegen smoke check, and JSON round-trip. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/histogram2d/Histogram2DOpDescSpec.scala | Adds unit tests for Histogram2D descriptor metadata, defaults, output schema, codegen guard, and JSON round-trip. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ No material benchmark regressions detected🟢 4 better · 🔴 0 worse · ⚪ 11 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,463.55,200,128000,431,0.263,22731.79,31420.97,31420.97
1,100,10,64,20,2064.30,2000,1280000,969,0.591,103394.75,114113.47,114113.47
2,1000,10,64,20,17938.37,20000,12800000,1115,0.680,900116.23,951951.15,951951.15 |
…d output port in viz specs Address Copilot review feedback on apache#5827: the output-schema tests asserted only .values.head, so a regression that keyed the schema under the wrong PortIdentity would still pass as long as there was a single entry. Assert the full Map is keyed by operatorInfo.outputPorts.head.id (and feed the input under operatorInfo.inputPorts.head.id) in HtmlViz / Candlestick / Histogram2D specs.
…d output port in column-transform specs Proactively apply the same strengthening Copilot requested on the visualization specs (apache#5827): TypeCasting and UnnestString schema-propagation tests asserted only .values.head, which passes even if the schema is produced under the wrong PortIdentity. Assert the full Map keyed by operatorInfo.outputPorts.head.id and feed the input under operatorInfo.inputPorts.head.id.
…tions + round-trip Address Copilot review feedback on apache#5827: the issue/PR scope said HtmlVizOpDescSpec pins htmlContentAttrName's annotations and that the config round-trips, but the spec only checked the default value. Add reflection-based assertions for @JsonProperty(required = true) + @AutofillAttributeName + @NotNull('HTML content cannot be empty') (mirroring UrlVizOpDescSpec) and a polymorphic JSON round-trip of htmlContentAttrName, so the spec matches the stated scope.
…rator descriptors (apache#5827) ### What changes were proposed in this PR? Pin behavior of three previously-untested visualization descriptors in `common/workflow-operator/`. No production-code changes. | Spec | Source class | Tests | | --- | --- | --- | | `HtmlVizOpDescSpec` | `HtmlVizOpDesc` | 4 | | `CandlestickChartOpDescSpec` | `CandlestickChartOpDesc` | 5 | | `Histogram2DOpDescSpec` | `Histogram2DOpDesc` | 6 | All three spec files follow the `<srcClassName>Spec.scala` one-to-one convention. **Behavior pinned** | Surface | Contract | | --- | --- | | `operatorInfo` | exact name + visualization group (`MEDIA` / `FINANCIAL` / `STATISTICAL`); one input / one output | | Output schema | all three emit a single `html-content` STRING column (`HtmlViz` via `getExternalOutputSchemas`; charts via `getOutputSchemas`) | | `getPhysicalOp` wiring (`HtmlViz`) | `OpExecWithClassName("…htmlviz.HtmlVizOpExec")`; port **identities** carried forward | | Field defaults | `Candlestick` OHLC columns default `""`; `Histogram2D` `xBins`/`yBins == 10`, `normalize == DENSITY` | | `generatePythonCode` | `Candlestick` emits a Plotly `go.Candlestick(` figure; `Histogram2D` emits `px.density_heatmap(` and **rejects a non-positive bin count** (`AssertionError`) | | Round-trip | all config fields preserved through the polymorphic base | The specs pin the stable contract (operatorInfo + output schema + codegen guards) rather than the full Plotly template, and never assert on interpolated `EncodableString` values (which are decoded at runtime, not embedded raw). ### Any related issues, documentation, discussions? Closes apache#5824. ### How was this PR tested? Pure unit-test additions; verified locally with: - `sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.visualization.htmlviz.HtmlVizOpDescSpec org.apache.texera.amber.operator.visualization.candlestickChart.CandlestickChartOpDescSpec org.apache.texera.amber.operator.visualization.histogram2d.Histogram2DOpDescSpec"` — 15 tests, all green - `sbt "WorkflowOperator/Test/scalafmtCheck"` and `sbt "WorkflowOperator/Test/scalafix --check"` — clean - CI to confirm ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 4.8 [1M context])
What changes were proposed in this PR?
Pin behavior of three previously-untested visualization descriptors in
common/workflow-operator/. No production-code changes.HtmlVizOpDescSpecHtmlVizOpDescCandlestickChartOpDescSpecCandlestickChartOpDescHistogram2DOpDescSpecHistogram2DOpDescAll three spec files follow the
<srcClassName>Spec.scalaone-to-one convention.Behavior pinned
operatorInfoMEDIA/FINANCIAL/STATISTICAL); one input / one outputhtml-contentSTRING column (HtmlVizviagetExternalOutputSchemas; charts viagetOutputSchemas)getPhysicalOpwiring (HtmlViz)OpExecWithClassName("…htmlviz.HtmlVizOpExec"); port identities carried forwardCandlestickOHLC columns default"";Histogram2DxBins/yBins == 10,normalize == DENSITYgeneratePythonCodeCandlestickemits a Plotlygo.Candlestick(figure;Histogram2Demitspx.density_heatmap(and rejects a non-positive bin count (AssertionError)The specs pin the stable contract (operatorInfo + output schema + codegen guards) rather than the full Plotly template, and never assert on interpolated
EncodableStringvalues (which are decoded at runtime, not embedded raw).Any related issues, documentation, discussions?
Closes #5824.
How was this PR tested?
Pure unit-test additions; verified locally with:
sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.visualization.htmlviz.HtmlVizOpDescSpec org.apache.texera.amber.operator.visualization.candlestickChart.CandlestickChartOpDescSpec org.apache.texera.amber.operator.visualization.histogram2d.Histogram2DOpDescSpec"— 15 tests, all greensbt "WorkflowOperator/Test/scalafmtCheck"andsbt "WorkflowOperator/Test/scalafix --check"— cleanWas this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])