[
https://issues.apache.org/jira/browse/BEAM-4546?focusedWorklogId=111728&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-111728
]
ASF GitHub Bot logged work on BEAM-4546:
----------------------------------------
Author: ASF GitHub Bot
Created on: 14/Jun/18 00:20
Start Date: 14/Jun/18 00:20
Worklog Time Spent: 10m
Work Description: robertwb commented on a change in pull request #5639:
[BEAM-4546] Multi level combine
URL: https://github.com/apache/beam/pull/5639#discussion_r195273106
##########
File path: sdks/python/apache_beam/transforms/core.py
##########
@@ -1337,6 +1350,74 @@ def default_type_hints(self):
return hints
+class _CombinePerKeyWithHotKeyFanout(PTransform):
+
+ def __init__(self, combine_fn, fanout):
+ self._fanout_fn = (
+ (lambda key: fanout) if isinstance(fanout, int) else fanout)
+ self._combine_fn = combine_fn
+
+ def expand(self, pcoll):
+
+ from apache_beam.transforms.trigger import AccumulationMode
+ combine_fn = self._combine_fn
+ fanout_fn = self._fanout_fn
+
+ class SplitHotCold(DoFn):
+ counter = 0
+ def process(self, element):
+ key, value = element
+ fanout = fanout_fn(key)
+ if not fanout or fanout is 1:
Review comment:
I've changed it to require an integer.
There are definitely cases where some keys are much more frequent than
others, and can be detected. (E.g. word distributions in natural languages.)
However, this also accepts a plain integer, which I expect will be use most of
the time, which is why I simply called it `fanout`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 111728)
Time Spent: 50m (was: 40m)
> Implement with hot key fanout for combiners
> -------------------------------------------
>
> Key: BEAM-4546
> URL: https://issues.apache.org/jira/browse/BEAM-4546
> Project: Beam
> Issue Type: New Feature
> Components: sdk-py-core
> Reporter: Ahmet Altay
> Assignee: Robert Bradshaw
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)