test(workflow-operator): add unit test coverage for ML scorer and sort enums#6044
Conversation
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
Adds ScalaTest unit coverage in common/workflow-operator to pin the serialization/wire-contract behavior of three existing Java enums used by ML scorer and sort operators, without changing production logic.
Changes:
- Add
SortPreferenceSpecvalidating enum constant set and Jackson round-trip via constant names. - Add
classificationMetricsFncSpecvalidating@JsonValuewire names, constant count, and Jackson round-trip. - Add
regressionMetricsFncSpecvalidating@JsonValuewire names, constant count, and Jackson round-trip.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/sort/SortPreferenceSpec.scala | New unit tests for SortPreference constant set and Jackson serialization/deserialization. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/machineLearning/Scorer/regressionMetricsFncSpec.scala | New unit tests pinning regressionMetricsFnc wire names (@JsonValue) and Jackson round-trip. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/machineLearning/Scorer/classificationMetricsFncSpec.scala | New unit tests pinning classificationMetricsFnc wire names (@JsonValue) and Jackson round-trip. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6044 +/- ##
============================================
- Coverage 56.93% 56.93% -0.01%
+ Complexity 3026 3024 -2
============================================
Files 1129 1129
Lines 43794 43794
Branches 4743 4743
============================================
- Hits 24936 24933 -3
- Misses 17384 17385 +1
- Partials 1474 1476 +2
*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:
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 390 | 0.238 | 25,857/32,363/32,363 us | 🟢 -17.0% / 🔴 +114.7% |
| ⚪ | bs=100 sw=10 sl=64 | 791 | 0.483 | 125,226/143,490/143,490 us | ⚪ within ±5% / 🔴 +33.4% |
| ⚪ | bs=1000 sw=10 sl=64 | 918 | 0.56 | 1,089,406/1,130,078/1,130,078 us | ⚪ within ±5% / 🔴 +10.4% |
Baseline details
Latest main 434bcae from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 390 tuples/sec | 385 tuples/sec | 777.62 tuples/sec | +1.3% | -49.8% |
| bs=10 sw=10 sl=64 | MB/s | 0.238 MB/s | 0.235 MB/s | 0.475 MB/s | +1.3% | -49.9% |
| bs=10 sw=10 sl=64 | p50 | 25,857 us | 24,236 us | 12,612 us | +6.7% | +105.0% |
| bs=10 sw=10 sl=64 | p95 | 32,363 us | 38,972 us | 15,070 us | -17.0% | +114.7% |
| bs=10 sw=10 sl=64 | p99 | 32,363 us | 38,972 us | 18,360 us | -17.0% | +76.3% |
| bs=100 sw=10 sl=64 | throughput | 791 tuples/sec | 787 tuples/sec | 988.31 tuples/sec | +0.5% | -20.0% |
| bs=100 sw=10 sl=64 | MB/s | 0.483 MB/s | 0.48 MB/s | 0.603 MB/s | +0.6% | -19.9% |
| bs=100 sw=10 sl=64 | p50 | 125,226 us | 124,862 us | 101,066 us | +0.3% | +23.9% |
| bs=100 sw=10 sl=64 | p95 | 143,490 us | 143,353 us | 107,594 us | +0.1% | +33.4% |
| bs=100 sw=10 sl=64 | p99 | 143,490 us | 143,353 us | 115,830 us | +0.1% | +23.9% |
| bs=1000 sw=10 sl=64 | throughput | 918 tuples/sec | 921 tuples/sec | 1,019 tuples/sec | -0.3% | -10.0% |
| bs=1000 sw=10 sl=64 | MB/s | 0.56 MB/s | 0.562 MB/s | 0.622 MB/s | -0.4% | -10.0% |
| bs=1000 sw=10 sl=64 | p50 | 1,089,406 us | 1,086,704 us | 986,982 us | +0.2% | +10.4% |
| bs=1000 sw=10 sl=64 | p95 | 1,130,078 us | 1,133,517 us | 1,028,491 us | -0.3% | +9.9% |
| bs=1000 sw=10 sl=64 | p99 | 1,130,078 us | 1,133,517 us | 1,058,493 us | -0.3% | +6.8% |
Raw CSV
config_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,513.01,200,128000,390,0.238,25857.43,32362.81,32362.81
1,100,10,64,20,2529.39,2000,1280000,791,0.483,125225.69,143490.37,143490.37
2,1000,10,64,20,21782.36,20000,12800000,918,0.560,1089405.70,1130078.15,1130078.15Per review: rename classificationMetricsFncSpec/regressionMetricsFncSpec (class + file) to ClassificationMetricsFncSpec/RegressionMetricsFncSpec for Scala naming consistency and test-report discoverability.
What changes were proposed in this PR?
Pin behavior of three previously-untested ML-scorer / sort enums in
common/workflow-operator. No production-code changes.classificationMetricsFncSpecclassificationMetricsFncregressionMetricsFncSpecregressionMetricsFncSortPreferenceSpecSortPreferenceBehavior pinned
classificationMetricsFnc/regressionMetricsFnc@JsonValuenames (Accuracy/Precision Score/…,MSE/RMSE/…); constant countsSortPreferenceASC/DESCconstants (no@JsonValue, so serialized by constant name)Any related issues, documentation, discussions?
Part of the ongoing
workflow-operatorunit-test coverage effort.How was this PR tested?
sbt "WorkflowOperator/testOnly *classificationMetricsFncSpec *regressionMetricsFncSpec *SortPreferenceSpec"— 6 tests, all greensbt "WorkflowOperator/Test/scalafmtCheck"andsbt "WorkflowOperator/scalafixAll --check"— cleanWas this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])