You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/03/24 18:36:09 UTC

[GitHub] [beam] chrisgorgo commented on a change in pull request #11204: [BEAM-9579] Fix numpy logic operators

chrisgorgo commented on a change in pull request #11204: [BEAM-9579] Fix numpy logic operators
URL: https://github.com/apache/beam/pull/11204#discussion_r397377585
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/stats.py
 ##########
 @@ -430,11 +430,11 @@ class ApproximateQuantilesCombineFn(CombineFn):
   def __init__(
       self, num_quantiles, buffer_size, num_buffers, key=None, reverse=False):
     if key:
-      self._comparator = lambda a, b: (key(a) < key(b)) - (key(a) > key(b)) \
-        if reverse else (key(a) > key(b)) - (key(a) < key(b))
+      self._comparator = lambda a, b: (key(a) < key(b)) ^ (key(a) > key(b)) \
 
 Review comment:
   good catch! fixed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services