You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/23 05:00:42 UTC

[PR] test(workflow-operator): cover the SQL source's batch boundaries and dispatch [texera]

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

   ### What changes were proposed in this PR?
   
   `SQLSourceOpExecSpec` goes from 30 tests to 40, covering the batch-boundary arithmetic and type dispatch in `SQLSourceOpExec`.
   
   Measured with the `FileScanSourceOpExecSpec` suite-name exclusion applied identically to the before and after run — that suite aborts on this machine for pre-existing reasons, and because sbt-jacoco runs unforked a failing test task skips `saveRuntimeData` and emits an all-zero report rather than a partial one.
   
   | Metric | Before | After |
   |---|---|---|
   | Codecov (fully-covered lines) | 139/163 = 85.3% | **147/163 = 90.2%** |
   | Missed lines | 4 (230, 231, 364, 519) | **0** |
   | JaCoCo line-hit | 159/163 = 97.6% | **163/163 = 100%** |
   | Branch arms | 127 covered / 43 missed | **137 covered / 33 missed** |
   
   Tests: spec 30 → 40; the `source.sql.*` package 176 → 186 across 11 suites; the module 2307 → 2317.
   
   ### The +8 is not eight lines of behaviour, and the first draft implied it was
   
   Of the eight newly fully-covered lines, **five are production-reachable behaviour** — the INTEGER and DOUBLE type dispatch, the progressive arm of the offset guard, the non-auto LONG maximum, and the non-auto unsupported-type throw. The other **three are defensive arms no workflow can reach**: `hasNextQuery`'s unsupported-type throw is unreachable because a successful `open()` admits only INTEGER/LONG/TIMESTAMP/DOUBLE, and two more are similar guards.
   
   A reviewer put the split at +6 reachable / +2 defensive. That was closer than the original claim but still not right; the measured split is 5 and 3.
   
   ### Verification
   
   22 mutations, **20 killed, 2 survivors.** Every one of the nine mutants the two reviewers reported as surviving was first *reproduced surviving* on the pre-review spec, and eight of the nine now die.
   
   **The two survivors are deliberate, and killing them would make the suite worse.** `isLastBatch = nextLowerBound >= upperBound` can be flipped to `>` on both the LONG arm (line 282) and its DOUBLE twin (line 285) and survive all 186 package tests. This was verified by running it, not inferred. The only input that distinguishes the two makes production emit a **duplicate final window** — so a test that killed these mutants would cement that defect. Reported instead.
   
   ### Corrections to my own first draft
   
   - "10 mutations, all 10 killed, zero survivors" was true of that table, but the table was too narrow to support the bundle's claims — nine further mutants on the very lines the bundle claimed to newly cover were untested, and most of them survived.
   - The +8/+10 figures reproduce exactly, but were stated without the reachability qualification above.
   - The conclusion drawn from line 502 was wrong even though its coverage half was right.
   - Module baselines were off by two: 208 missed lines (96.59%) and 1215 missed branches (51.96%), not 206/1214.
   - Line counts and test counts in the first draft were stale.
   - One assertion — `(statement.setLong _).expects(*, *).never()` — carried no information beyond the strict mock itself and is gone, replaced by a positive `expects(1, 2L)` whose strictness does the work.
   - A CI-wiring claim from the first draft is not restated here, because it was not re-verified in this pass.
   
   ### Deliberately not included, with evidence
   
   - **Four `case A | B | C | _ =>` arms** (230, 286, 320, 357) keep a dead `ifeq` side: scalac compiles the `_` as a constant before the final branch.
   - **Ten lines** are sealed-`Option` `None$.equals` checks falling through to `new scala/MatchError`, plus an `$outer` null check and a non-local-return rethrow.
   - **Line 502's `batchByAttribute.isDefined` false arm is dead**: `initBatchColumnBoundaries` is private with one caller, `open()`, which always assigns `Option(schema.getAttribute(...))`, and `Schema.getAttribute` throws rather than returning null. Widening the private would be a production edit — refused.
   - **Line 472's `if (limit > 0)` false arm is unreachable**: `generateSqlQuery` returns `None` whenever the limit is `Some(n <= 0)`, so 472 is only reached when the limit is positive. Getting there needs the protected `generateSqlQuery` overridden, i.e. replacing the code under test.
   
   No production file is touched — sha256 unchanged from the pre-mutation snapshot, and no stray `test_large_binary.txt` was left behind, since the FileScan suite never ran.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7868
   
   ### How was this PR tested?
   
   ```
   sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.sql.SQLSourceOpExecSpec"
   ```
   
   ```
   [info] Total number of tests run: 40
   [info] Tests: succeeded 40, failed 0, canceled 0, ignored 0, pending 0
   ```
   
   The whole `source.sql.*` package is green at 186 tests across 11 suites, 0 aborted. `Test/scalafmtCheck` passes.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(workflow-operator): cover the SQL source's batch boundaries and dispatch [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7871:
URL: https://github.com/apache/texera/pull/7871#issuecomment-5384319982

   <!-- texera-reviewer-suggestion -->
   ### Automated Reviewer Suggestions
   
   Based on the `git blame` history of the changed files, we recommend the following reviewers:
   
   - **Contributors with relevant context:** `@mengw15`
     You can notify them by mentioning `@mengw15` in a comment.
   


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(workflow-operator): cover the SQL source's batch boundaries and dispatch [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #7871:
URL: https://github.com/apache/texera/pull/7871


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(workflow-operator): cover the SQL source's batch boundaries and dispatch [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7871:
URL: https://github.com/apache/texera/pull/7871#issuecomment-5384341825

   <!-- texera-benchmarks-comment -->
   ## ⚠️ Benchmark changes need a look
   
   🟢 0 better · 🔴 7 worse · ⚪ 8 noise (<±5%) · 0 without baseline
   
   > Compared against main `21be7ac` 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](https://apache.github.io/texera/dev/bench/) · [Run](https://github.com/apache/texera/actions/runs/32619279108)
   
   | | config | throughput | MB/s | latency | max Δ latest / 7d |
   |---|---|---:|---:|---:|---:|
   | 🔴 | bs=10 sw=10 sl=64 | 391 | 0.238 | 25,298/36,859/36,859 us | 🔴 +16.8% / 🔴 +156.3% |
   | ⚪ | bs=100 sw=10 sl=64 | 828 | 0.505 | 119,854/133,383/133,383 us | ⚪ within ±5% / 🔴 +34.0% |
   | 🔴 | bs=1000 sw=10 sl=64 | 914 | 0.558 | 1,087,964/1,209,288/1,209,288 us | 🔴 +8.6% / 🔴 +27.0% |
   
   <details><summary>Baseline details</summary>
   
   Latest main `21be7ac` from same runner
   
   | config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
   |---|---|---:|---:|---:|---:|---:|
   | bs=10 sw=10 sl=64 | throughput | 391 tuples/sec | 441 tuples/sec | 833.79 tuples/sec | -11.3% | -53.1% |
   | bs=10 sw=10 sl=64 | MB/s | 0.238 MB/s | 0.269 MB/s | 0.509 MB/s | -11.5% | -53.2% |
   | bs=10 sw=10 sl=64 | p50 | 25,298 us | 21,658 us | 11,864 us | +16.8% | +113.2% |
   | bs=10 sw=10 sl=64 | p95 | 36,859 us | 34,031 us | 14,381 us | +8.3% | +156.3% |
   | bs=10 sw=10 sl=64 | p99 | 36,859 us | 34,031 us | 18,035 us | +8.3% | +104.4% |
   | bs=100 sw=10 sl=64 | throughput | 828 tuples/sec | 841 tuples/sec | 1,083 tuples/sec | -1.5% | -23.6% |
   | bs=100 sw=10 sl=64 | MB/s | 0.505 MB/s | 0.513 MB/s | 0.661 MB/s | -1.6% | -23.6% |
   | bs=100 sw=10 sl=64 | p50 | 119,854 us | 115,361 us | 93,077 us | +3.9% | +28.8% |
   | bs=100 sw=10 sl=64 | p95 | 133,383 us | 138,418 us | 99,553 us | -3.6% | +34.0% |
   | bs=100 sw=10 sl=64 | p99 | 133,383 us | 138,418 us | 108,604 us | -3.6% | +22.8% |
   | bs=1000 sw=10 sl=64 | throughput | 914 tuples/sec | 942 tuples/sec | 1,119 tuples/sec | -3.0% | -18.3% |
   | bs=1000 sw=10 sl=64 | MB/s | 0.558 MB/s | 0.575 MB/s | 0.683 MB/s | -3.0% | -18.3% |
   | bs=1000 sw=10 sl=64 | p50 | 1,087,964 us | 1,061,595 us | 909,247 us | +2.5% | +19.7% |
   | bs=1000 sw=10 sl=64 | p95 | 1,209,288 us | 1,113,701 us | 952,561 us | +8.6% | +27.0% |
   | bs=1000 sw=10 sl=64 | p99 | 1,209,288 us | 1,113,701 us | 985,186 us | +8.6% | +22.7% |
   
   </details>
   
   <details><summary>Raw CSV</summary>
   
   ```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,512.09,200,128000,391,0.238,25298.49,36858.53,36858.53
   1,100,10,64,20,2414.90,2000,1280000,828,0.505,119853.52,133383.02,133383.02
   2,1000,10,64,20,21885.59,20000,12800000,914,0.558,1087963.75,1209288.24,1209288.24
   ```
   
   </details>
   


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(workflow-operator): cover the SQL source's batch boundaries and dispatch [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7871:
URL: https://github.com/apache/texera/pull/7871#issuecomment-5384329776

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/7871?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 91.98%. Comparing base ([`ce0510d`](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4bd1233`](https://app.codecov.io/gh/apache/texera/commit/4bd12332c2a894adcc7136db0857572ce791e732?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 3 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##               main    #7871   +/-   ##
   =========================================
     Coverage     91.98%   91.98%           
     Complexity     4510     4510           
   =========================================
     Files          1173     1173           
     Lines         47346    47346           
     Branches       5305     5305           
   =========================================
     Hits          43550    43550           
     Misses         2155     2155           
     Partials       1641     1641           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
   |---|---|---|---|
   | [access-control-service](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.00% <ø> (ø)` | | |
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `98.62% <ø> (ø)` | | Carriedforward from [ce0510d](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [amber](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `88.45% <ø> (ø)` | | Carriedforward from [ce0510d](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.67% <ø> (ø)` | | Carriedforward from [ce0510d](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [config-service](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.73% <ø> (ø)` | | |
   | [file-service](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `75.74% <ø> (ø)` | | Carriedforward from [ce0510d](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `93.99% <ø> (ø)` | | Carriedforward from [ce0510d](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `79.13% <ø> (ø)` | | |
   | [pyamber](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `97.52% <ø> (ø)` | | Carriedforward from [ce0510d](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/7871/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.19% <ø> (ø)` | | Carriedforward from [ce0510d](https://app.codecov.io/gh/apache/texera/commit/ce0510d32cdf654184a6d3d27ce9da11e2bf4bc6?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/7871?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(workflow-operator): cover the SQL source's batch boundaries and dispatch [texera]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7871:
URL: https://github.com/apache/texera/pull/7871#discussion_r3837766283


##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/sql/SQLSourceOpExecSpec.scala:
##########
@@ -202,7 +219,47 @@ class SQLSourceOpExecSpec extends AnyFlatSpec with Matchers with MockFactory {
     exec.sqlQuery shouldBe Some(BASE + ";")
   }
 
+  it should "skip the sliding window when progressive mode names no batch column" in {
+    // A progressive descriptor with no batchByColumn is degenerate but generateSqlQuery is
+    // defensive about it. open() is deliberately not called here: it would blow up on
+    // `desc.batchByColumn.get`, which is the current (unhelpful) behaviour, so this test
+    // pins only the query builder. That also means this exact arm of the line-419 guard
+    // (progressive with no batch column) is defensive: no production caller reaches

Review Comment:
   The comment references a specific production line number ("line-419 guard"), which will go stale as SQLSourceOpExec.scala changes. Prefer describing the condition (the progressive-mode guard in generateSqlQuery) without hard-coding line numbers.



##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/sql/SQLSourceOpExecSpec.scala:
##########
@@ -279,13 +336,59 @@ class SQLSourceOpExecSpec extends AnyFlatSpec with Matchers with MockFactory {
     exec.nextQueryAvailable shouldBe false
   }
 
+  it should "offer a next query while an INTEGER batch column is below its upper bound" in {
+    val conn = boundaryConn(
+      "id",
+      (rs, side) => (rs.getInt(_: Int)).expects(1).returning(if (side == "MIN") 0 else 10)
+    )
+    val exec = openedProgressive("id", "auto", "auto", 4L, conn)
+
+    exec.nextQueryAvailable shouldBe true
+    exec.slidingWindow shouldBe " AND id >= 0 AND id < 4"
+
+    // A single-value range (min == max) must still yield exactly one window. This is the
+    // one input on which the `<=` in hasNextQuery is load-bearing, and unlike the
+    // exact-multiple case it does not exercise the duplicate-last-window defect.
+    val singleValueConn =
+      boundaryConn("id", (rs, _) => (rs.getInt(_: Int)).expects(1).returning(7))
+    val singleValue = openedProgressive("id", "auto", "auto", 4L, singleValueConn)
+    singleValue.nextQueryAvailable shouldBe true
+    singleValue.slidingWindow shouldBe " AND id >= 7 AND id <= 7"
+    singleValue.nextQueryAvailable shouldBe false
+  }
+
+  it should "refuse to decide the next query for an unsupported batch column type" in {
+    val exec = new TestSQLSourceOpExec(progressiveJson("name", Option("a"), Option("z"), 4L))
+    // DEFENSIVE-ONLY arm: intercepting open() is the only way to be holding a STRING batch
+    // column here, so no workflow can reach this throw. A successful open() admits only
+    // INTEGER/LONG/TIMESTAMP/DOUBLE -- non-auto boundaries reject all but LONG/TIMESTAMP,
+    // and auto probes reject BOOLEAN/STRING/ANY -- and all four are handled above.
+    intercept[IllegalArgumentException](exec.open())
+    intercept[IllegalArgumentException](exec.nextQueryAvailable).getMessage shouldBe
+      "Unexpected type: string"

Review Comment:
   This test depends on open() partially initializing state (batchByAttribute) before throwing, in order to exercise hasNextQuery's unsupported-type branch. That makes it brittle to refactors of open() that change when/if batchByAttribute is set. You can make the test more direct by setting batchByAttribute explicitly and avoiding the open() call.



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org