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

   ### What changes were proposed in this PR?
   
   Pin behavior of two previously-uncovered helpers in 
`common/workflow-operator`. No production-code changes.
   
   | Spec | Source class | Tests |
   | --- | --- | --- |
   | `AutoClosingIteratorSpec` | `AutoClosingIterator` | 10 |
   | `UnionOpExecSpec` | `UnionOpExec` | 7 |
   
   Both spec files follow the `<srcClassName>Spec.scala` one-to-one convention.
   
   **Behavior pinned — `AutoClosingIterator`**
   
   | Surface | Contract |
   | --- | --- |
   | `hasNext` (non-empty source) | `true`; `onClose` not invoked |
   | `hasNext` (exhausted source) | `false`; `onClose` invoked exactly once |
   | Repeated `hasNext` after exhaustion | does NOT re-fire `onClose` 
(`alreadyClosed` guard) |
   | `next()` | delegates straight to the wrapped iterator (in order) |
   | Full traversal via `toList` | yields every element; `onClose` fires once 
at the end |
   | Already-empty source | first `hasNext` returns `false` and fires `onClose` 
|
   | Mid-iteration | `onClose` stays un-fired between elements |
   | `onClose` throws | exception propagates (no swallowing) |
   | `onClose` throws + retry | current impl re-fires `onClose` (assignment to 
`alreadyClosed` runs AFTER `onClose()`); characterization pins this behavior |
   
   **Behavior pinned — `UnionOpExec`**
   
   | Surface | Contract |
   | --- | --- |
   | `processTuple(tuple, port = 0)` | yields a single-element iterator 
containing the tuple |
   | `processTuple` (any port) | port-agnostic — same tuple passes through for 
ports 0, 1, 5, 99, MaxValue, -1 |
   | Tuple identity | pass-through preserves the exact `Tuple` reference (no 
copy) |
   | Successive calls | each returns an independent fresh iterator (no shared 
cursor) |
   | Per-call iterator | yields exactly one element |
   | `null` tuple | passes through as `null` (the impl does not null-check) |
   | Type contract | `UnionOpExec` is an `OperatorExecutor` |
   
   ### Any related issues, documentation, discussions?
   
   Closes #5653.
   
   ### How was this PR tested?
   
   Pure unit-test additions; verified locally with:
   
   - `sbt "WorkflowOperator/testOnly 
org.apache.texera.amber.operator.source.scan.AutoClosingIteratorSpec 
org.apache.texera.amber.operator.union.UnionOpExecSpec"` — 17 tests, all green
   - `sbt scalafmtCheckAll` — clean
   - CI to confirm
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.7 [1M context])


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to