vishalmore90 opened a new pull request, #41564:
URL: https://github.com/apache/beam/pull/41564

   fixes #41563
   
   ### Description
   In Beam YAML, the `Join` transform (`yaml_join._validate_equalities`) 
validates that equality condition columns exist on upstream inputs. Previously, 
column names were obtained strictly via `getattr(pcoll.element_type, '_fields', 
[])`.
   
   This caused validation failures on valid Beam schema PCollections:
   1. Standard Python `@dataclass` types do not have a `_fields` attribute 
(they use `__dataclass_fields__`), so `valid_cols` evaluated to `set()`.
   2. Schemas with leading underscore fields (e.g. CDC metadata columns like 
`_change_type`) use `dataclasses.make_dataclass` dynamically because 
`NamedTuple` rejects leading underscores.
   3. Untyped or dynamically typed inputs caused false-positive rejections.
   
   This PR:
   - Introduces `_extract_field_names` to extract schema columns via Beam's 
canonical `named_fields_from_element_type`, falling back to `_fields` for 
unannotated namedtuples.
   - Skips field validation when schema fields cannot be determined statically 
at graph construction time, preventing false-positive pipeline construction 
errors.
   - Adds comprehensive unit tests for dataclass schema inputs, invalid field 
errors on dataclasses, and untyped inputs.
   
   ### Checklist
   - [x] Contributor License Agreement signed (if applicable).
   - [x] PR description references the issue (`fixes #41563`).
   - [x] Unit tests added and passing.


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