BjornPrime commented on code in PR #24435:
URL: https://github.com/apache/beam/pull/24435#discussion_r1036307417


##########
sdks/python/apache_beam/transforms/combiners.py:
##########
@@ -537,8 +536,9 @@ def extract_output(self, accumulator, *args, **kwargs):
     else:
       assert not holds_comparables
 
-    assert len(heap) <= self._n
-    heap.sort(reverse=True)
+    if heap:

Review Comment:
   Added null checking to handle empty variables that would've triggered the 
two assertions removed from this file.
   This was the only error to emerge from removing the assertions. It seems 
that an empty accumulators being passed at lines 501 and 531 is what those 
assertions were meant to handle, but other than this, the existing logic 
handles it fine.



-- 
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]

Reply via email to