Skip to content

test(workflow-operator): cover the SQL, R-UDF, scorer and ECDF descriptors - #7899

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:cov/operator-descriptors
Aug 24, 2026
Merged

aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:cov/operator-descriptors

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Four operator descriptors. 36 tests → 47.

Measured with a full-module WorkflowOperator/jacoco, one fresh sbt JVM per run, and the same suite-name exclusion on both sides (FileScanSourceOpExecSpec aborts inside a git worktree — a worktree's .git is a file, so it throws RepositoryNotFoundException in beforeAll — and since sbt-jacoco runs unforked, a failing test task yields an all-zero report rather than a partial one).

File Codecov Missed arms
SQLSourceOpDesc.scala 88.9% → 100% 11 → 0
RUDFSourceOpDesc.scala 80.6% → 100% 3 → 0
MachineLearningScorerOpDesc.scala 84.8% → 100% 4 → 0
ECDFPlotOpDesc.scala 85.4% → 87.5% (its ceiling) 15 → 12
bundle 173/203 = 85.2% → 192/203 = 94.6% 48 → 27

JaCoCo line-hit goes 199/203 → 203/203.

TimeSeriesOpDesc was in the original scope and is deliberately absent. It is worth exactly zero: all five of its partials are Scala's null-safe comparison against a String literal, where one arm requires the constant itself to be null. A probe setting every field to null left it unchanged at 23/28. And the null path is a crash rather than a behaviour — dropnaCols.map(c => pyb"$c") NPEs inside the pyb macro on Base64 of a null string. Pinning it would cement junk.

Verification

28 mutations, 27 killed, 1 equivalent survivor.

The first draft reported no survivors. Two adversarial reviewers demonstrated 8 survivors between them, and every one that could be reproduced was real. All are now dead.

Representative repairs, each proven by the mutation it now kills:

  • The JDBC type map pinned 9 of 19 keys; the remaining ten are now covered (TINYINT→INTEGER, FLOAT/REAL→DOUBLE, BIT→BOOLEAN, and the rest).
  • Three error-message assertions used endWith, leaving the half of the message that names the failing operator unpinned. They are now exact equalities against the concrete subclass name the spec itself controls.
  • ECDF argument assertions were presence-only; they now check payloads through the spec's existing Base64 helper, and three index-arithmetic assertions pin the emitted body's order (pd.to_numeric( before px.ecdf( before plotly.io.to_html().
  • The scorer's actual and predicted columns were interchangeable; the loose whole-code include checks are now line-anchored.

The survivor: deleting .withParallelizable(false) from the else arm of RUDF's worker-count guard. PhysicalOp.sourcePhysicalOp already defaults it, so nothing observable changes — an equivalent mutant, not a coverage gap.

Two reviewer suggestions were refused

  • One proposed deleting the RUDF single-worker test as vacuous. The premise was half right — the withParallelizable(false) call really is unobservable — but the suggested fix would have made the suite weaker, since the test pins more than that one call.
  • Its optional follow-up asked for a production deletion, which this pass forbids. Recorded as a limitation rather than actioned.

A collateral claim about the builder's own harness was also left unasserted rather than repeated, on the grounds that it could not be verified from the state the worktree was handed over in.

A nondeterminism source found along the way

The module-wide branch total does not move by exactly the amount these four files account for, and the residual is not measurement noise in this bundle: it is IntervalJoinOpExec.scala, whose covering spec uses an unseeded RNG, so its branch count drifts run to run. That is worth knowing because it makes module-level branch totals unquotable as evidence for any PR touching this module. Seeding that spec is already part of #7800.

Same-input reproducibility is otherwise good: the final jacoco.xml is byte-identical to a reviewer's independently produced report.

Deliberately not included, with evidence

  • ECDFPlotOpDesc cannot exceed 42/48. javap on createPlotlyFigure shows the three-jump null-safe form, and the ifnull-taken arm needs the literal "sum" to be null. A probe moved those lines from cb=3 to cb=5 with mb unchanged — 8 arms, zero lines. Two further lines would need a hashCode collision with "count" or "sum" that is not equal to it: constructible in principle, padding in practice.
  • The scorer's last two lines are reachable only through an erasure violation. The LUB of the two metric list types erases to java.lang.Enum, so the lambda bridge's checkcast admits a foreign enum — List(java.time.DayOfWeek.MONDAY).asInstanceOf[…] does reach the case _ throw and takes the file to 33/33. No production route exists, because Jackson rejects an unknown enum name first, so it is excluded.
  • The six require message strings are lifted to $anonfun$querySchema$1..6 and dropped by SyntheticFilter; their source lines already read as covered because the closure allocation is attributed to the enclosing method.
  • One file's headline 100% is worth qualifying: the foldLeft body making its only schema-typing decision is a $anonfun, so it is not in the tracked denominator either way.

Every spec in the bundle carries a JSON round-trip test, per house convention. No descriptor subtype is defined in any spec, because PythonCodeRawInvalidTextSpec instantiates every subclass by reflection and a test-only subtype would break it.

No production file is touched, and no stray test_large_binary.txt was left behind.

Any related issues, documentation, discussions?

Closes #7898

How was this PR tested?

sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.sql.SQLSourceOpDescSpec org.apache.texera.amber.operator.udf.r.RUDFSourceOpDescSpec org.apache.texera.amber.operator.machineLearning.Scorer.MachineLearningScorerOpDescSpec org.apache.texera.amber.operator.visualization.ecdfPlot.ECDFPlotOpDescSpec"
[info] Total number of tests run: 47
[info] Tests: succeeded 47, failed 0, canceled 0, ignored 0, pending 0

Test/scalafmtCheck and Test/scalafix --check both pass.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

…ptors

36 tests to 47. SQLSourceOpDesc, RUDFSourceOpDesc and
MachineLearningScorerOpDesc all reach 100%; ECDFPlotOpDesc reaches its
structural ceiling of 42/48. The bundle goes 85.2% to 94.6% and missed
branch arms 48 to 27.

TimeSeriesOpDesc was in the original scope and is deliberately absent: all
five of its partials are Scala's null-safe comparison against a String
literal, where one arm needs the constant itself to be null, and the null
path is a crash inside the pyb macro rather than a behaviour.

28 mutations, 27 killed. The first pass reported no survivors while two
reviewers demonstrated eight. The remaining one is equivalent --
PhysicalOp.sourcePhysicalOp already defaults the value it deletes.

Found while measuring, and worth knowing beyond this PR: module-wide branch
totals are not quotable as evidence here, because IntervalJoinOpExec's
covering spec uses an unseeded RNG and its branch count drifts run to run.
Copilot AI lite review requested due to automatic review settings August 24, 2026 04:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @kz930, @roshiiiz
    You can notify them by mentioning @kz930, @roshiiiz in a comment.

@codecov-commenter

codecov-commenter commented Aug 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.40%. Comparing base (fcfd112) to head (5f14206).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7899      +/-   ##
============================================
+ Coverage     92.36%   92.40%   +0.04%     
- Complexity     4584     4605      +21     
============================================
  Files          1173     1173              
  Lines         47347    47347              
  Branches       5306     5306              
============================================
+ Hits          43731    43752      +21     
+ Misses         2020     2015       -5     
+ Partials       1596     1580      -16     
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø)
agent-service 98.62% <ø> (ø) Carriedforward from 8b76feb
amber 89.07% <ø> (+0.12%) ⬆️
computing-unit-managing-service 73.67% <ø> (ø)
config-service 86.73% <ø> (ø)
file-service 82.59% <ø> (ø)
frontend 94.21% <ø> (ø) Carriedforward from 8b76feb
notebook-migration-service 79.13% <ø> (ø)
pyamber 97.52% <ø> (ø) Carriedforward from 8b76feb
workflow-compiling-service 77.19% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 2 better · 🔴 7 worse · ⚪ 6 noise (<±5%) · 0 without baseline

Compared against main 4786d6c benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 413 0.252 23,907/31,479/31,479 us 🔴 +22.3% / 🔴 +119.6%
🔴 bs=100 sw=10 sl=64 916 0.559 106,001/128,651/128,651 us 🔴 +10.9% / 🔴 +29.3%
⚪ bs=1000 sw=10 sl=64 1,109 0.677 894,092/969,383/969,383 us ⚪ within ±5% / ⚪ within ±5%
Baseline details

Latest main 4786d6c from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 413 tuples/sec 459 tuples/sec 833.1 tuples/sec -10.0% -50.4%
bs=10 sw=10 sl=64 MB/s 0.252 MB/s 0.28 MB/s 0.508 MB/s -10.0% -50.4%
bs=10 sw=10 sl=64 p50 23,907 us 19,553 us 11,860 us +22.3% +101.6%
bs=10 sw=10 sl=64 p95 31,479 us 33,567 us 14,334 us -6.2% +119.6%
bs=10 sw=10 sl=64 p99 31,479 us 33,567 us 18,194 us -6.2% +73.0%
bs=100 sw=10 sl=64 throughput 916 tuples/sec 967 tuples/sec 1,085 tuples/sec -5.3% -15.6%
bs=100 sw=10 sl=64 MB/s 0.559 MB/s 0.59 MB/s 0.662 MB/s -5.3% -15.6%
bs=100 sw=10 sl=64 p50 106,001 us 103,174 us 92,973 us +2.7% +14.0%
bs=100 sw=10 sl=64 p95 128,651 us 116,057 us 99,460 us +10.9% +29.3%
bs=100 sw=10 sl=64 p99 128,651 us 116,057 us 107,737 us +10.9% +19.4%
bs=1000 sw=10 sl=64 throughput 1,109 tuples/sec 1,127 tuples/sec 1,111 tuples/sec -1.6% -0.2%
bs=1000 sw=10 sl=64 MB/s 0.677 MB/s 0.688 MB/s 0.678 MB/s -1.6% -0.2%
bs=1000 sw=10 sl=64 p50 894,092 us 880,979 us 915,816 us +1.5% -2.4%
bs=1000 sw=10 sl=64 p95 969,383 us 925,512 us 959,066 us +4.7% +1.1%
bs=1000 sw=10 sl=64 p99 969,383 us 925,512 us 993,644 us +4.7% -2.4%
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,483.85,200,128000,413,0.252,23907.34,31479.08,31479.08
1,100,10,64,20,2183.30,2000,1280000,916,0.559,106001.21,128651.24,128651.24
2,1000,10,64,20,18038.96,20000,12800000,1109,0.677,894092.00,969383.23,969383.23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@mengw15 mengw15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Xinyuan Lin <xinyual3@uci.edu>
@aglinxinyuan
aglinxinyuan enabled auto-merge August 24, 2026 06:23
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 24, 2026
Merged via the queue into apache:main with commit 10663c9 Aug 24, 2026
31 checks passed
@aglinxinyuan
aglinxinyuan deleted the cov/operator-descriptors branch August 24, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover the SQL, R-UDF, scorer and ECDF operator descriptors

4 participants