Zeyad-Hassan-1 opened a new pull request, #715:
URL: https://github.com/apache/wayang/pull/715
Fixes #632
## What was broken:
1. **Tuple Type Validation:** `typecheck()` in `types.py` was not handling
tuple types correctly. When a user passes `(str, int)` as a type,
`get_origin()` returns `None`, so the existing `isinstance(input_type, Tuple)`
check never matched.
- **Fix:** Added a separate branch using `isinstance(input_type, tuple)`
with recursion to support nested types like `(typing.Tuple[str, int],
typing.Tuple[str, int])`.
2. **Python 3.12+ Compatibility:** `get_type_flatmap_function()` used
`type(sig.return_annotation) != type(Iterable)`, which breaks in Python 3.12+
because `Iterable` and `Iterable[str]` are represented as different internal
classes.
- **Fix:** Switched to using `get_origin(sig.return_annotation) is not
collections.abc.Iterable` for more robust validation across Python versions.
## Verification:
The previously skipped `test_wordcount` now passes end-to-end, integrated
with the Java JSON server.
> **Note:** During testing, I observed that the word count results are
consistently **off by +1** for each word.
--
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]