aglinxinyuan opened a new issue, #5653:
URL: https://github.com/apache/texera/issues/5653

   ## Background
   
   Two small helpers in `common/workflow-operator` currently lack a dedicated 
unit-spec:
   
   | Source class | Package | Purpose |
   | --- | --- | --- |
   | `AutoClosingIterator` | `operator.source.scan` | Wraps an `Iterator[T]` 
with an `onClose: () => Unit` callback that fires exactly once when the 
underlying iterator reports `hasNext == false`. Used by scan sources to release 
input streams as soon as iteration ends. |
   | `UnionOpExec` | `operator.union` | Trivial pass-through 
`OperatorExecutor`; `processTuple` yields the input tuple unchanged for every 
input port. |
   
   ## Behavior to pin
   
   ### `AutoClosingIterator`
   
   | Surface | Contract |
   | --- | --- |
   | `hasNext` on a non-empty underlying iterator | returns `true`; `onClose` 
is NOT invoked |
   | `hasNext` on an exhausted underlying iterator | returns `false`; `onClose` 
IS invoked exactly once |
   | Repeated `hasNext` after exhaustion | does NOT invoke `onClose` again 
(`alreadyClosed` guard) |
   | `next()` | delegates straight to the wrapped iterator |
   | Full traversal via `toList` | yields every element of the wrapped iterator 
in order; `onClose` fires once when the loop sees `hasNext == false` |
   | Iterator constructed over an already-empty source | first `hasNext` call 
returns `false` and fires `onClose` |
   | `onClose` exceptions | propagate to the caller of `hasNext` (no 
swallowing) |
   
   ### `UnionOpExec`
   
   | Surface | Contract |
   | --- | --- |
   | `processTuple(tuple, port = 0)` | yields a single-element `Iterator` 
containing the input tuple |
   | `processTuple(tuple, port = N)` | yields the same tuple regardless of 
input port id |
   | Repeated invocations | each call returns its own fresh iterator (no state 
leakage) |
   | `null` tuple | propagates `null` through the iterator (pass-through is 
unconditional) |
   
   ## Scope
   
   - New spec files (one per source class):
     - `AutoClosingIteratorSpec.scala`
     - `UnionOpExecSpec.scala`
   - No production-code changes.


-- 
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