Skip to content

Conversation

@liferoad
Copy link
Contributor

Check schema compatibility when flattening PCollections to ensure all inputs have matching schemas. This prevents runtime errors from schema mismatches.

Addresses #35666


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

Check schema compatibility when flattening PCollections to ensure all inputs have matching schemas. This prevents runtime errors from schema mismatches.
Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

- Split long comment line for better readability in yaml_provider.py
- Rename test method create_has_schema to test_create_has_schema
- Change expected exception type from ValueError to Exception in schema validation test
- Add new test cases for flattening compatible schemas and null values
- Fix circular reference test to actually test successful execution
pickle_library='cloudpickle')) as p:
# This should raise an error because null values create different schema types
# (nullable logical type vs INT64)
with self.assertRaisesRegex(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damccorm I do not like this but Beam treat this case with different schemas since passenger_count should be INT64 not None. So we report the error now with this validation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting - one option would be to define our own deep equality function here (basically a consistency check), or we could try to move forward with #35672

I don't think we can move forward with this change if it regresses these use cases

pickle_library='cloudpickle')) as p:
# This should raise an error because null values create different schema types
# (nullable logical type vs INT64)
with self.assertRaisesRegex(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting - one option would be to define our own deep equality function here (basically a consistency check), or we could try to move forward with #35672

I don't think we can move forward with this change if it regresses these use cases

@liferoad liferoad closed this Jul 24, 2025
@liferoad
Copy link
Contributor Author

decided to do the forward fix #35672 later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants