[
https://issues.apache.org/jira/browse/BEAM-9579?focusedWorklogId=409007&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-409007
]
ASF GitHub Bot logged work on BEAM-9579:
----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Mar/20 18:36
Start Date: 24/Mar/20 18:36
Worklog Time Spent: 10m
Work Description: chrisgorgo commented on 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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 409007)
Time Spent: 50m (was: 40m)
> 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: 50m
> 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)