[ 
https://issues.apache.org/jira/browse/BEAM-9579?focusedWorklogId=408917&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-408917
 ]

ASF GitHub Bot logged work on BEAM-9579:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Mar/20 16:55
            Start Date: 24/Mar/20 16:55
    Worklog Time Spent: 10m 
      Work Description: aaltay commented on 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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 408917)
    Time Spent: 40m  (was: 0.5h)

> ApproximateQuantilesCombineFn uses deprecated '-' operator
> ----------------------------------------------------------
>
>                 Key: BEAM-9579
>                 URL: https://issues.apache.org/jira/browse/BEAM-9579
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Chris Gorgolewski
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> This causes a TypeError with numpy 1.16.4
>  
> {{apache_beam/transforms/stats.py", line 437, in <lambda>}}
> {{ else (a > b) - (a < b)}}
> {{TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the 
> bitwise_xor, the `^` operator, or the logical_xor function instead.}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to