test(workflow-core): fill uncovered branches in tuple and type utilities#6055
Conversation
Targets Codecov-missed lines: Tuple (24), TupleLike (32), AttributeType (18), AttributeTypeUtils (20), ArrowUtils (15). Extends the existing TupleSpec, AttributeTypeUtilsSpec, and ArrowUtilsSpec, and adds TupleLikeSpec and AttributeTypeSpec.
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
This PR increases unit-test coverage in the common/workflow-core module by exercising previously uncovered branches in tuple/type utilities and Arrow tuple round-tripping, without modifying production code.
Changes:
- Expanded
TupleSpecto cover additionalTuplebehaviors (schema enforcement, equality branches, partial tuples, builder guards). - Added new specs for
TupleLikeandAttributeTypeto cover factory overloads and type mappings. - Extended
AttributeTypeUtilsSpecandArrowUtilsSpecto cover parsing/casting edge paths and Arrow↔Texera tuple conversions (including metadata/tag and failure fallbacks).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| common/workflow-core/src/test/scala/org/apache/texera/amber/util/ArrowUtilsSpec.scala | Adds round-trip tests for appendTexeraTuple/setTexeraTuple/getTexeraTuple, parse-failure fallback, null handling, and schema metadata fallback. |
| common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/TupleSpec.scala | Adds coverage for getField overloads, enforceSchema, equality branches, partial tuple creation, toString, builder guards, and case-class synthetics. |
| common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/TupleLikeSpec.scala | New suite covering SeqTupleLike/MapTupleLike enforcement behaviors and TupleLike.apply overloads (including the iterable-guard implicit). |
| common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/AttributeTypeUtilsSpec.scala | Adds coverage for schema/tuple casting helpers, parse/infer branches, numeric compare ordering, and unsupported-type error branches. |
| common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/AttributeTypeSpec.scala | New suite covering getName (including ANY branch), getAttributeType(Class) mappings, and round-trips via getFieldClass. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keep both sides of ArrowUtilsSpec: main's State wire-hop tuple round-trip and this branch's setTexeraTuple/appendTexeraTuple/getTexeraTuple coverage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6055 +/- ##
============================================
+ Coverage 56.37% 56.61% +0.23%
- Complexity 2992 3007 +15
============================================
Files 1129 1129
Lines 43802 43802
Branches 4743 4743
============================================
+ Hits 24695 24799 +104
+ Misses 17658 17569 -89
+ Partials 1449 1434 -15
*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 | 397 | 0.243 | 24,983/36,688/36,688 us | 🔴 +15.5% / 🔴 +148.2% |
| 🔴 | bs=100 sw=10 sl=64 | 792 | 0.483 | 125,798/156,251/156,251 us | 🔴 +18.2% / 🔴 +46.2% |
| ⚪ | bs=1000 sw=10 sl=64 | 925 | 0.565 | 1,081,672/1,148,620/1,148,620 us | ⚪ within ±5% / 🔴 +12.2% |
Baseline details
Latest main 878eb8a from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 397 tuples/sec | 406 tuples/sec | 786.27 tuples/sec | -2.2% | -49.5% |
| bs=10 sw=10 sl=64 | MB/s | 0.243 MB/s | 0.248 MB/s | 0.48 MB/s | -2.0% | -49.4% |
| bs=10 sw=10 sl=64 | p50 | 24,983 us | 21,627 us | 12,495 us | +15.5% | +99.9% |
| bs=10 sw=10 sl=64 | p95 | 36,688 us | 34,117 us | 14,784 us | +7.5% | +148.2% |
| bs=10 sw=10 sl=64 | p99 | 36,688 us | 34,117 us | 18,468 us | +7.5% | +98.7% |
| bs=100 sw=10 sl=64 | throughput | 792 tuples/sec | 841 tuples/sec | 991.49 tuples/sec | -5.8% | -20.1% |
| bs=100 sw=10 sl=64 | MB/s | 0.483 MB/s | 0.513 MB/s | 0.605 MB/s | -5.8% | -20.2% |
| bs=100 sw=10 sl=64 | p50 | 125,798 us | 120,046 us | 100,929 us | +4.8% | +24.6% |
| bs=100 sw=10 sl=64 | p95 | 156,251 us | 132,220 us | 106,894 us | +18.2% | +46.2% |
| bs=100 sw=10 sl=64 | p99 | 156,251 us | 132,220 us | 114,085 us | +18.2% | +37.0% |
| bs=1000 sw=10 sl=64 | throughput | 925 tuples/sec | 910 tuples/sec | 1,023 tuples/sec | +1.6% | -9.6% |
| bs=1000 sw=10 sl=64 | MB/s | 0.565 MB/s | 0.556 MB/s | 0.624 MB/s | +1.6% | -9.5% |
| bs=1000 sw=10 sl=64 | p50 | 1,081,672 us | 1,104,210 us | 983,835 us | -2.0% | +9.9% |
| bs=1000 sw=10 sl=64 | p95 | 1,148,620 us | 1,144,170 us | 1,023,777 us | +0.4% | +12.2% |
| bs=1000 sw=10 sl=64 | p99 | 1,148,620 us | 1,144,170 us | 1,053,883 us | +0.4% | +9.0% |
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,503.23,200,128000,397,0.243,24983.19,36688.41,36688.41
1,100,10,64,20,2526.10,2000,1280000,792,0.483,125798.11,156251.25,156251.25
2,1000,10,64,20,21618.08,20000,12800000,925,0.565,1081672.24,1148620.33,1148620.33
What changes were proposed in this PR?
Fill uncovered code paths in five
workflow-coretuple/type utility classes, selected from the Codecov report (not spec-name gaps). No production-code changes.Tuple.scalagetFieldmiss/Attribute overload,enforceSchema, equals branches (incl. binary contents / non-Tuple),getPartialTuple,toString, size/type-mismatch throws, 3-arg builderadd+ null guards, case-class syntheticsTupleLike.scalaSeqTupleLike/MapTupleLikeenforceSchema(positional vs name-based, null fill, extras dropped),inMemSize???, all sevenTupleLike.applyoverloads, theNotAnIterableguard implicitAttributeType.javagetNameANY branch (""), the fullgetAttributeType(Class)mapping incl. primitive/unknown fallback to ANYAttributeTypeUtils.scalaSchemaCasting,tupleCasting, bothparseFieldsoverloads, null-inference early-returns, BINARY/ANY inference fallback, LONG/DOUBLEcompare, unsupported-type throws, forced-parse failuresArrowUtils.scalaappendTexeraTuple/setTexeraTuple/getTexeraTupleround-trip (all 7 types + nulls + row indices), parse-failure → null field,fromAttributeType(null)throw, unrecognizedtexera_typemetadata fallbackExtends the existing
TupleSpec,AttributeTypeUtilsSpec, andArrowUtilsSpec(the operator-moduleArrowUtilsSpecdoesn't attribute coverage toworkflow-coresources), and addsTupleLikeSpec/AttributeTypeSpec.Behavior notes pinned along the way:
$attrTypeerror messages render the lowercase wire name; theNotAnIterableiterable-guard implicit is not summoned for multi-iterable varargs under Scala 2.13 inference (pinned by direct invocation).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 "WorkflowCore/testOnly *TupleSpec *TupleLikeSpec *AttributeTypeSpec *AttributeTypeUtilsSpec org.apache.texera.amber.util.ArrowUtilsSpec"— 105 tests, all greensbt "WorkflowCore/Test/scalafmtCheck"andsbt "WorkflowCore/scalafixAll --check"— cleanWas this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])