You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "derrickaw (via GitHub)" <gi...@apache.org> on 2026/06/26 16:59:59 UTC
[PR] add more coverage for yaml [beam]
derrickaw opened a new pull request, #39126:
URL: https://github.com/apache/beam/pull/39126
First of several PRs for https://github.com/apache/beam/issues/39125
------------------------
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](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add more coverage for yaml [beam]
Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw closed pull request #39126: add more coverage for yaml
URL: https://github.com/apache/beam/pull/39126
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add more coverage for yaml [beam]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #39126:
URL: https://github.com/apache/beam/pull/39126#discussion_r3483679969
##########
sdks/python/apache_beam/yaml/yaml_provider_unit_test.py:
##########
@@ -377,3 +372,260 @@ def test_create_mixed_types(self):
[('a', None), ('element', 1)],
[('a', 2), ('element', None)],
]))
+
+
+class YamlProvidersFlattenTest(unittest.TestCase):
+ def test_flatten_schema_merging(self):
+ with beam.Pipeline() as p:
+ pcoll1 = p | 'C1' >> beam.Create([beam.Row(a=1)])
+ pcoll2 = p | 'C2' >> beam.Create([beam.Row(b=2)])
+ res = {
+ 'first': pcoll1, 'second': pcoll2
+ } | yaml_provider.YamlProviders.Flatten()
+ assert_that(
+ res | beam.Map(lambda x: sorted(x._asdict().items())),
+ equal_to([
+ [('a', 1), ('b', None)],
+ [('a', None), ('b', 2)],
+ ]))
+
+ def test_flatten_single_pcoll(self):
+ with beam.Pipeline() as p:
+ pcoll = p | beam.Create([beam.Row(a=1)])
+ res = pcoll | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([beam.Row(a=1)]))
+
+ def test_flatten_empty(self):
+ with beam.Pipeline() as p:
+ res = p | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([]))
+
+ def test_flatten_single_pcoll(self):
+ with beam.Pipeline() as p:
+ pcoll = p | beam.Create([beam.Row(a=1)])
+ res = pcoll | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([beam.Row(a=1)]))
+
+ def test_flatten_empty(self):
+ with beam.Pipeline() as p:
+ res = p | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([]))
Review Comment:

The test methods `test_flatten_single_pcoll` and `test_flatten_empty` are duplicated in this class. The second set of definitions can be safely removed to keep the test suite clean and maintainable.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add more coverage for yaml [beam]
Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39126:
URL: https://github.com/apache/beam/pull/39126#discussion_r3483712693
##########
sdks/python/apache_beam/yaml/yaml_provider_unit_test.py:
##########
@@ -377,3 +372,260 @@ def test_create_mixed_types(self):
[('a', None), ('element', 1)],
[('a', 2), ('element', None)],
]))
+
+
+class YamlProvidersFlattenTest(unittest.TestCase):
+ def test_flatten_schema_merging(self):
+ with beam.Pipeline() as p:
+ pcoll1 = p | 'C1' >> beam.Create([beam.Row(a=1)])
+ pcoll2 = p | 'C2' >> beam.Create([beam.Row(b=2)])
+ res = {
+ 'first': pcoll1, 'second': pcoll2
+ } | yaml_provider.YamlProviders.Flatten()
+ assert_that(
+ res | beam.Map(lambda x: sorted(x._asdict().items())),
+ equal_to([
+ [('a', 1), ('b', None)],
+ [('a', None), ('b', 2)],
+ ]))
+
+ def test_flatten_single_pcoll(self):
+ with beam.Pipeline() as p:
+ pcoll = p | beam.Create([beam.Row(a=1)])
+ res = pcoll | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([beam.Row(a=1)]))
+
+ def test_flatten_empty(self):
+ with beam.Pipeline() as p:
+ res = p | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([]))
+
+ def test_flatten_single_pcoll(self):
+ with beam.Pipeline() as p:
+ pcoll = p | beam.Create([beam.Row(a=1)])
+ res = pcoll | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([beam.Row(a=1)]))
+
+ def test_flatten_empty(self):
+ with beam.Pipeline() as p:
+ res = p | yaml_provider.YamlProviders.Flatten()
+ assert_that(res, equal_to([]))
Review Comment:
Thanks
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add more coverage for yaml [beam]
Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on PR #39126:
URL: https://github.com/apache/beam/pull/39126#issuecomment-6024918027
Going to redo this into smaller PRs.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add more coverage for yaml [beam]
Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on PR #39126:
URL: https://github.com/apache/beam/pull/39126#issuecomment-4812812408
/gemini review
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add more coverage for yaml [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #39126:
URL: https://github.com/apache/beam/pull/39126#issuecomment-5570842593
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org