Skip to content

test(workflow-operator): add unit test coverage for SQLSourceOpDesc schema introspection#6078

Open
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:test-sql-source-desc
Open

test(workflow-operator): add unit test coverage for SQLSourceOpDesc schema introspection#6078
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:test-sql-source-desc

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add unit test coverage for SQLSourceOpDesc.querySchema — the abstract SQL source descriptor's JDBC schema-introspection path — selected from the Codecov report. No production-code changes.

SQLSourceOpDesc (40.5% covered) is abstract; its concrete subclasses (MySQL/PostgreSQL/AsterixDB) never exercise querySchema because their specs supply no connection. The 27 missed lines are covered here via a small test subclass whose establishConn returns ScalaMock-backed java.sql.Connection/DatabaseMetaData/ResultSet — no live database.

Covered:

  • the connection-field null guard (returns null until all fields set)
  • every JDBC-TypesAttributeType mapping arm (INTEGER/SMALLINT, DOUBLE/NUMERIC, BOOLEAN, BINARY, VARCHAR, BIGINT, TIMESTAMP)
  • default-port resolution via updatePort() and multi-column iteration
  • the unknown-data-type RuntimeException
  • the SQLException → wrapped-RuntimeException catch
  • the abstract base establishConn default (returns no connection → NullPointerException)

Any related issues, documentation, discussions?

Follow-up to the review feedback on #6043: prioritize tests that fill uncovered code paths.

How was this PR tested?

  • sbt "WorkflowOperator/testOnly *SQLSourceOpDescSpec" — 16 tests, all green
  • sbt "WorkflowOperator/Test/scalafmtCheck" and sbt "WorkflowOperator/scalafixAll --check" — clean

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

Generated-by: Claude Code (Opus 4.8 [1M context])

…uerySchema

Targets Codecov-missed lines (27) in the abstract SQL descriptor's schema
introspection: JDBC-type-to-AttributeType mapping, default-port resolution,
unknown-type rejection, SQLException wrapping, and the base establishConn default.
Driven by ScalaMock-backed JDBC interfaces (no live database).
Copilot AI review requested due to automatic review settings July 3, 2026 07:03
@github-actions github-actions Bot added the common label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

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

  • No candidates found from git blame history.

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

Adds focused unit tests in common/workflow-operator to cover SQLSourceOpDesc’s JDBC schema-introspection path (sourceSchema()querySchema) without requiring a live database, using ScalaMock-backed Connection/DatabaseMetaData/ResultSet mocks.

Changes:

  • Introduces a test-only concrete SQLSourceOpDesc subclass that supplies a mocked JDBC connection and a deterministic updatePort() implementation.
  • Adds assertions covering: null-guard behavior, JDBC TypesAttributeType mappings, multi-column iteration, default-port resolution, unknown-type failure, and SQLException wrapping.
  • Adds a regression-style test documenting the base establishConn default (null) leading to a NullPointerException when schema introspection is attempted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

codecov-commenter commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.26%. Comparing base (a53d95a) to head (a41af4a).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6078      +/-   ##
============================================
+ Coverage     57.21%   57.26%   +0.04%     
- Complexity     3103     3114      +11     
============================================
  Files          1130     1130              
  Lines         43825    43825              
  Branches       4747     4747              
============================================
+ Hits          25075    25096      +21     
+ Misses        17313    17289      -24     
- Partials       1437     1440       +3     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø)
agent-service 44.59% <ø> (ø) Carriedforward from a53d95a
amber 59.60% <ø> (+0.12%) ⬆️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 52.30% <ø> (ø)
file-service 62.81% <ø> (ø)
frontend 50.12% <ø> (ø) Carriedforward from a53d95a
notebook-migration-service 78.57% <ø> (ø)
pyamber 91.15% <ø> (ø) Carriedforward from a53d95a
python 90.69% <ø> (ø) Carriedforward from a53d95a
workflow-compiling-service 55.14% <ø> (ø)

*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 Jul 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main a53d95a 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 365 0.223 25,953/41,632/41,632 us 🔴 +23.8% / 🔴 +172.4%
bs=100 sw=10 sl=64 797 0.486 123,031/150,066/150,066 us ⚪ within ±5% / 🔴 +38.5%
bs=1000 sw=10 sl=64 916 0.559 1,089,776/1,145,717/1,145,717 us ⚪ within ±5% / 🔴 +10.5%
Baseline details

Latest main a53d95a from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 365 tuples/sec 394 tuples/sec 770.95 tuples/sec -7.4% -52.7%
bs=10 sw=10 sl=64 MB/s 0.223 MB/s 0.24 MB/s 0.471 MB/s -7.1% -52.6%
bs=10 sw=10 sl=64 p50 25,953 us 24,333 us 12,775 us +6.7% +103.2%
bs=10 sw=10 sl=64 p95 41,632 us 33,636 us 15,286 us +23.8% +172.4%
bs=10 sw=10 sl=64 p99 41,632 us 33,636 us 18,795 us +23.8% +121.5%
bs=100 sw=10 sl=64 throughput 797 tuples/sec 785 tuples/sec 976.93 tuples/sec +1.5% -18.4%
bs=100 sw=10 sl=64 MB/s 0.486 MB/s 0.479 MB/s 0.596 MB/s +1.5% -18.5%
bs=100 sw=10 sl=64 p50 123,031 us 125,078 us 102,557 us -1.6% +20.0%
bs=100 sw=10 sl=64 p95 150,066 us 153,610 us 108,383 us -2.3% +38.5%
bs=100 sw=10 sl=64 p99 150,066 us 153,610 us 115,249 us -2.3% +30.2%
bs=1000 sw=10 sl=64 throughput 916 tuples/sec 924 tuples/sec 1,009 tuples/sec -0.9% -9.2%
bs=1000 sw=10 sl=64 MB/s 0.559 MB/s 0.564 MB/s 0.616 MB/s -0.9% -9.2%
bs=1000 sw=10 sl=64 p50 1,089,776 us 1,081,993 us 997,695 us +0.7% +9.2%
bs=1000 sw=10 sl=64 p95 1,145,717 us 1,130,730 us 1,036,731 us +1.3% +10.5%
bs=1000 sw=10 sl=64 p99 1,145,717 us 1,130,730 us 1,069,334 us +1.3% +7.1%
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,548.60,200,128000,365,0.223,25953.38,41631.64,41631.64
1,100,10,64,20,2509.56,2000,1280000,797,0.486,123031.03,150066.44,150066.44
2,1000,10,64,20,21829.83,20000,12800000,916,0.559,1089775.88,1145717.15,1145717.15

@aglinxinyuan aglinxinyuan requested a review from mengw15 July 3, 2026 07:41
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.

3 participants