Skip to content

Conversation

@Polber
Copy link
Contributor

@Polber Polber commented Jan 18, 2024

Adds time unit suffixes (ms, s, m, h, d) to windowing syntax.


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.

Signed-off-by: Jeffrey Kinard <jeff@thekinards.com>
@Polber
Copy link
Contributor Author

Polber commented Jan 18, 2024

R: @robertwb

@github-actions
Copy link
Contributor

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

Copy link
Contributor

@robertwb robertwb left a comment

Choose a reason for hiding this comment

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

Thanks.

return pcoll | self._window_transform

@staticmethod
def _parse_time_unit(value, name):
Copy link
Contributor

Choose a reason for hiding this comment

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

While for a lot of the yaml construction, integration tests are more natural than unit tests, this function is of the right form to add some good unit tests too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some tests - required moving the classes around so they are visible outside the file.

Signed-off-by: Jeffrey Kinard <jeff@thekinards.com>
Copy link
Contributor

@robertwb robertwb left a comment

Choose a reason for hiding this comment

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

Just missing some unit tests.

"Valid time units are {}.").format(
name,
suffix,
', '.join("'{}'".format(k) for k in time_units.keys())))
Copy link
Contributor

Choose a reason for hiding this comment

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

You could probably just do ', '.join(time_units.keys()).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought this looked prettier...

Invalid windowing size time unit 't'. Valid time units are 'ms', 's', 'm', 'h', 'd'.
vs.
Invalid windowing size time unit 't'. Valid time units are ms, s, m, h, d

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, that's fine.

@Polber Polber force-pushed the jkinard/windowing-time-units branch 4 times, most recently from 409eaf0 to 68f5768 Compare January 18, 2024 20:52
@Polber Polber requested a review from robertwb January 18, 2024 20:53
@Polber Polber force-pushed the jkinard/windowing-time-units branch from 68f5768 to 14957de Compare January 19, 2024 00:11
"Valid time units are {}.").format(
name,
suffix,
', '.join("'{}'".format(k) for k in time_units.keys())))
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, that's fine.

@robertwb
Copy link
Contributor

robertwb commented Jan 19, 2024

Looks like test_expand_composite_transform_with_name_input is too strict. (What was that test trying to verify?)

@Polber Polber force-pushed the jkinard/windowing-time-units branch from 14957de to efac0b5 Compare January 19, 2024 03:43
@Polber
Copy link
Contributor Author

Polber commented Jan 19, 2024

Looks like test_expand_composite_transform_with_name_input is too strict. (What was that test trying to verify?)

I'm not exactly sure what it is trying to test exactly. Looks like it is the same test as the ones around it except has a defined input, but the input isn't what is checked in the test (the output is). I think many of those tests need to be rewritten

@Polber Polber force-pushed the jkinard/windowing-time-units branch from efac0b5 to f8dc3c4 Compare January 19, 2024 04:06
Signed-off-by: Jeffrey Kinard <jeff@thekinards.com>
@Polber Polber force-pushed the jkinard/windowing-time-units branch from f8dc3c4 to b6c207d Compare January 19, 2024 05:33
@robertwb robertwb merged commit 81688eb into apache:master Jan 19, 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.

2 participants