shunping opened a new pull request, #35311:
URL: https://github.com/apache/beam/pull/35311

   Copied from the inline comments:
   
   In 
[`ImpulseSeqGenRestrictionProvider`](https://github.com/apache/beam/blob/facdc4e0e73fd938d5ca5c6ebbbe46b534e8f05a/sdks/python/apache_beam/transforms/periodicsequence.py#L45),
 the total number of counts (i.e. `total_outputs`) is computed by `ceil((end - 
start) / interval)`, where `end` is `start + duration * interval`.
   
   Due to precision error of arithmetic operations, even if duration is set to 
`len(self._data)`, `(end - start) / interval` could be a little bit smaller or 
bigger than `len(self._data)`.
   
   In case of being bigger, `total_outputs` would be `len(self._data) + 1`, as 
the `ceil()` operation is used.
   
   Assuming that the precision error is no bigger than 1%, by subtracting a 
small amount, we ensure that the result after `ceil()` is stable even if the 
precision error is present.


-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to