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

   ### What changes were proposed in this PR?
   
   Adds `test_input_manager.py` (new, 20 tests) for the Python worker's 
`InputManager` 
(`amber/src/main/python/core/architecture/packaging/input_manager.py`), which 
had no direct unit tests — the Scala `InputManager` is covered by #5451, but 
the Python counterpart was only exercised indirectly through `MainLoop`. Uses a 
real `InternalQueue`, in-memory `Schema`/`pyarrow` tables, and stubbed reader 
runnables, so no engine or storage is needed.
   
   The suite covers:
   - **Registration** — `add_input_port` / `register_input`: `None` 
`id`/`internal` fields are normalized to `0`/`False`, re-adding an existing 
port is ignored, and channel-to-port bindings are checked in both directions.
   - **Completion tracking** — completing a channel marks its port; 
`all_ports_completed` is vacuously `True` with zero ports; completing one 
channel completes the whole port even if its other channels are still open 
(safe today because the `EndChannel` ECM is port-aligned — documented in a test 
comment).
   - **Channel filtering** — `get_all_data_channel_ids` excludes control 
channels.
   - **Materialization readers** — mismatched `uris`/`partitionings` raise; one 
reader is created per URI with the right pairing; a second setup replaces the 
readers instead of appending; finished readers are not restarted, and 
unfinished ones run on daemon threads.
   - **`process_data_payload`** — a DataFrame becomes `Tuple`s carrying the 
port's schema; an empty table yields nothing; a StateFrame passes through 
unchanged; a DataFrame from an unregistered channel fails only when the 
generator is consumed; unknown payload types raise `NotImplementedError`.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6486
   
   ### How was this PR tested?
   
   ```
   cd amber/src/main/python
   PYTHONPATH=. python -m pytest ../../test/python/core/architecture/packaging/ 
-v
   # 28 passed (20 new InputManager tests + 8 existing OutputManager tests)
   ```
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Co-authored by: Claude Code (Fable 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: [email protected]

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

Reply via email to