Polber commented on code in PR #30035:
URL: https://github.com/apache/beam/pull/30035#discussion_r1457887464
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -665,6 +675,27 @@ def __init__(self, windowing):
def expand(self, pcoll):
return pcoll | self._window_transform
+ @staticmethod
+ def _parse_time_unit(value, name):
+ time_units = {'s': 1, 'm': 60, 'h': 60 * 60, 'd': 60 * 60 * 12}
+ value, suffix = str(value)[:-1], str(value)[-1]
+ # Default to seconds if time unit suffix is not defined
+ if suffix.isnumeric():
+ value, suffix = value + suffix, 's'
+ elif not value or not value.isnumeric():
Review Comment:
Good idea
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -651,6 +651,16 @@ class WindowInto(beam.PTransform):
See [the Beam documentation on
windowing](https://beam.apache.org/documentation/programming-guide/#windowing)
for more details.
+ Sizes, offsets, periods and gaps (where applicable) must be defined using
+ a time unit suffix 's', 'm', 'h' or 'd' for seconds, minutes, hours
+ or days, respectively.
Review Comment:
done.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]