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 16:55:45 UTC

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

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

 ##########
 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:
   Maybe I am missing something here, but I think here we use - to get +1, 0 or -1 and ^ operator would not give us.

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