Anurag-S1ngh opened a new pull request, #41334: URL: https://github.com/apache/beam/pull/41334
## Summary Attribute access on NamedTuple-typed PCollections (the classes generated for schema'd collections, e.g. `ReadFromParquet(as_rows=True)`) and on `Optional[...]` row fields was inferred as `Any`, because `apache_beam/typehints/opcodes._getattr` only resolved `RowTypeConstraint` instances. A Beam YAML pipeline with `MapToFields` projecting a Parquet struct column failed at construction with "Beam logical types are not currently supported in arrow_type_compatibility". The inference now: - resolves NamedTuple classes directly (raw annotations, normalized), - unwraps Union/Optional members and resolves attribute types per member, keeping the result nullable, - passes results through `typehints.normalize` so inferred types compose with the rest of the typehint machinery. Note: with this fix the YAML pipeline from the issue builds; it then fails at runtime on a separate issue where `ReadFromParquet(as_rows=True)` yields dicts for struct fields (filed separately as #41100). Fixes #41099 ## Testing - New: `trivial_inference_test.py::TrivialInferenceTest::testNamedTupleAttr` and `testDataclassOptionalNestedAttr` - `pytest sdks/python/apache_beam/typehints/` (1427 passed) - `pytest sdks/python/apache_beam/runners/direct/direct_runner_test.py` (7 passed) - Beam YAML reproducer from the issue no longer fails at construction with "Beam logical types are not currently supported in arrow_type_compatibility" -- 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]
