Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 640e8df

Browse files
committed
Consider small periodic impulses as bounded.
1 parent f0f7a42 commit 640e8df

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sdks/python/apache_beam/transforms/periodicsequence.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,15 @@ def __init__(
192192
self.apply_windowing = apply_windowing
193193

194194
def expand(self, pbegin):
195-
result = (
195+
sequence = (
196196
pbegin
197197
| 'ImpulseElement' >> beam.Create(
198198
[(self.start_ts, self.stop_ts, self.interval)])
199-
| 'GenSequence' >> beam.ParDo(ImpulseSeqGenDoFn())
199+
| 'GenSequence' >> beam.ParDo(ImpulseSeqGenDoFn()))
200+
if self.stop_ts - self.start_ts < 5:
201+
sequence.is_bounded = True
202+
result = (
203+
sequence
200204
| 'MapToTimestamped' >> beam.Map(lambda tt: TimestampedValue(tt, tt)))
201205
if self.apply_windowing:
202206
result = result | 'ApplyWindowing' >> beam.WindowInto(

0 commit comments

Comments
 (0)