[ 
https://issues.apache.org/jira/browse/BEAM-3382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302613#comment-16302613
 ] 

ASF GitHub Bot commented on BEAM-3382:
--------------------------------------

aaltay closed pull request #4300: [BEAM-3382] Enforce strictly positive natural 
numbers for AfterCount timers
URL: https://github.com/apache/beam/pull/4300
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/python/apache_beam/transforms/trigger.py 
b/sdks/python/apache_beam/transforms/trigger.py
index 45aba6e5bcd..47b3ea480d9 100644
--- a/sdks/python/apache_beam/transforms/trigger.py
+++ b/sdks/python/apache_beam/transforms/trigger.py
@@ -23,6 +23,7 @@
 import collections
 import copy
 import itertools
+import numbers
 from abc import ABCMeta
 from abc import abstractmethod
 
@@ -378,6 +379,8 @@ class AfterCount(TriggerFn):
   COUNT_TAG = _CombiningValueStateTag('count', combiners.CountCombineFn())
 
   def __init__(self, count):
+    if not isinstance(count, numbers.Integral) or count < 1:
+      raise ValueError("count (%d) must be a positive integer." % count)
     self.count = count
 
   def __repr__(self):


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Validate count for trigger AfterCount 
> --------------------------------------
>
>                 Key: BEAM-3382
>                 URL: https://issues.apache.org/jira/browse/BEAM-3382
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>    Affects Versions: 2.2.0
>            Reporter: María GH
>            Assignee: María GH
>            Priority: Minor
>
> AfterCount's count should be a strictly positive natural number.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to