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 use cases for Enrichment transform in YAML #32289

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

reeba212
Copy link
Contributor

  1. Added a simple bigtable enrichment example
  2. Added an end to end use case that demonstrates how spanner IO and enrichment transform coupled with other YAML transforms can be used in a real world setting

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.

@reeba212 reeba212 changed the title Add use-cases for Enrichment transform in YAML [yaml] Add use cases for Enrichment transform in YAML Aug 22, 2024
Copy link
Contributor

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

R: @damccorm for label python.
R: @ahmedabu98 for label io.

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

Copy link
Contributor

@Polber Polber left a comment

Choose a reason for hiding this comment

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

Thanks! Added a few comments

sdks/python/apache_beam/io/gcp/bigquery_tools.py Outdated Show resolved Hide resolved
Comment on lines 77 to 78
options:
project_id: "apache-beam-testing"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? It is defined in all the transforms, so not sure why it would be required

Copy link
Contributor

@Polber Polber left a comment

Choose a reason for hiding this comment

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

Just a couple small changes, thanks!

sdks/python/apache_beam/io/gcp/bigquery_tools.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/yaml/integration_tests.py Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Sep 5, 2024

Reminder, please take a look at this pr: @damccorm @ahmedabu98

Copy link
Contributor

github-actions bot commented Sep 9, 2024

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @liferoad for label python.
R: @johnjcasey for label io.

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)

Copy link
Contributor

Reminder, please take a look at this pr: @liferoad @johnjcasey

Copy link
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @tvalentyn for label python.
R: @Abacn for label io.

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)

@damccorm
Copy link
Contributor

@Polber what are next steps on this PR?

@reeba212 it looks like some precommit checks are failing - would you mind taking a look? At a glance, I see:

  1. the RAT license check is missing - this is because some files are missing the Apache license
  2. Lint/format checks are failing - could you try https://cwiki.apache.org/confluence/display/BEAM/Python+Tips#PythonTips-LintandFormattingChecks
  3. test_bigtable_enrichment_yaml seems to be failing

@damccorm
Copy link
Contributor

damccorm commented Oct 3, 2024

@Polber @reeba212 friendly reminder to please take a look at this one when you have a chance

@Polber
Copy link
Contributor

Polber commented Oct 22, 2024

You should be able to rebase on master now and pull in the EnrichmentTransform changes

Copy link
Contributor

Reminder, please take a look at this pr: @tvalentyn @Abacn

Copy link
Contributor

github-actions bot commented Nov 4, 2024

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @damccorm for label python.
R: @chamikaramj for label io.

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)

@damccorm
Copy link
Contributor

damccorm commented Nov 4, 2024

R: @Polber

@Polber @reeba212 what are next steps here?

Copy link
Contributor

github-actions bot commented Nov 4, 2024

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@Polber Polber mentioned this pull request Nov 5, 2024
3 tasks
Copy link
Contributor

@Polber Polber left a comment

Choose a reason for hiding this comment

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

I left a couple comments that should help turn tests green.

This will require rebasing on #33027 once it is merged

Comment on lines 51 to 52
# Expected:
# Row(sale_id = 1, customer_id = 1, product_id = 1, quantity = 1, product = Row(product_id: "1", product_name = "pixel 5", product_stock = "2"))
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Add options block with experimental feature
  2. Unindent the Expected block
  3. Fix the formatting of the expected element (copy the below exactly)
Suggested change
# Expected:
# Row(sale_id = 1, customer_id = 1, product_id = 1, quantity = 1, product = Row(product_id: "1", product_name = "pixel 5", product_stock = "2"))
options:
yaml_experimental_features: Enrichment
# Expected:
# Row(sale_id=1, customer_id=1, product_id=1, quantity=1, product={'product_id': '1', 'product_name': 'pixel 5', 'product_stock': '2'})

['test_simple_filter_yaml', 'test_simple_filter_and_combine_yaml'])
['test_simple_filter_yaml', 'test_simple_filter_and_combine_yaml', 'test_spanner_read_yaml', 'test_spanner_write_yaml'])
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. There is a similar method above this one called _file_io_write_test_preprocessor. You need to add the following to the list in the @YamlExamplesTestSuite.register_test_preprocessor annotation
    • test_bigtable_enrichment_yaml
    • test_enrich_spanner_with_bigquery_yaml

Should look very similar to the change on line 159 above

input: WriteProcessedOrders.my_error_output
config:
path: 'errors.json'

Copy link
Contributor

Choose a reason for hiding this comment

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

Add Expected block:

Suggested change
# Expected:
# Row(customer_id=1001, customer_name='Alice', customer_email='[email protected]', product_id=2001, order_date='24-03-24', order_amount=150)
# Row(customer_id=1003, customer_name='Claire', customer_email='[email protected]', product_id=2003, order_date='7-05-24', order_amount=110)

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.

3 participants