Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YAML] Add Partition transform. #30368

Merged
merged 19 commits into from
Mar 29, 2024
Merged

Conversation

robertwb
Copy link
Contributor

This allows one to split a single PCollection into multiple distinct PCollections based on some property of the elements.

It performs the role of (numeric) partition and side outputs from other languages.


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.

Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @liferoad for label python.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@liferoad
Copy link
Collaborator

R: @Polber

Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

website/www/site/content/en/documentation/sdks/yaml-udf.md Outdated Show resolved Hide resolved
sdks/python/apache_beam/yaml/yaml_mapping.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/yaml/yaml_mapping.py Outdated Show resolved Hide resolved
website/www/site/content/en/documentation/sdks/yaml-udf.md Outdated Show resolved Hide resolved
@lostluck
Copy link
Contributor

lostluck commented Feb 29, 2024

I mostly object to calling a Split transform, when it's doing what we've termed largely as Partitioning in beam. Splitting as a Beam concept is generally around Bundles (and increasing Processing Parallelism within a PCollection). It does us no good to muddy the definitions.

So why is it not being called Partition?

@robertwb
Copy link
Contributor Author

I'm all for trying to find better names for this.

I thought about Partition, but Beam already has a Partition operation that's a bit different: it takes in a integer N and splits the PCollection into N numbered PCollections: https://beam.apache.org/documentation/programming-guide/#partition My other hesitation is that partition is used like shard (and roughly) parallelism of otherwise homogenous datasets in other systems like Kafka. But that's not a blocker.

I really haven't settled on naming that I like here (and went back and forth when writing this). Maybe we should bikeshed on the dev list.

@lostluck
Copy link
Contributor

I'd say while partitions are inherently numerically based, that's largely an implementation detail to serve the user goal of "turn 1 PCollection into N PCollections, known at Pipeline Construction Time".

Personally I'd say that the "standard" beam one is just a "PartitionByIndex", vs a general "PartitionBy" transform that this appears to be.

I have no objection to devlist bikeshedding though.

@robertwb robertwb changed the title [YAML] Add split transform. [YAML] Add Partition transform. Mar 6, 2024
@robertwb
Copy link
Contributor Author

robertwb commented Mar 6, 2024

After thinking about this some more, you've convinced my Partition is the way to go. Updated.

@robertwb
Copy link
Contributor Author

Now that the naming is settled, is there anything else that needs to be addressed?

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 92.68293% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 71.44%. Comparing base (65c3e8e) to head (fc480a9).
Report is 25 commits behind head on master.

❗ Current head fc480a9 differs from pull request most recent head 0fe48a2. Consider uploading reports for the commit 0fe48a2 to get more accurate results

Files Patch % Lines
sdks/python/apache_beam/yaml/yaml_mapping.py 92.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #30368      +/-   ##
==========================================
- Coverage   71.46%   71.44%   -0.02%     
==========================================
  Files         710      710              
  Lines      104795   104835      +40     
==========================================
+ Hits        74887    74903      +16     
- Misses      28277    28301      +24     
  Partials     1631     1631              
Flag Coverage Δ
python 81.24% <92.68%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Polber
Copy link
Contributor

Polber commented Mar 28, 2024

Now that the naming is settled, is there anything else that needs to be addressed?

@robertwb I have the two pending comments above, namely renaming Split to Partition in the docs

@robertwb
Copy link
Contributor Author

Ah, good catch. Done.

robertwb and others added 2 commits March 28, 2024 16:36
Co-authored-by: Jeff Kinard <jeff@thekinards.com>
@robertwb robertwb merged commit e3fee51 into apache:master Mar 29, 2024
74 of 75 checks passed
hjtran pushed a commit to hjtran/beam that referenced this pull request Apr 4, 2024
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.

4 participants