[
https://issues.apache.org/jira/browse/BEAM-6740?focusedWorklogId=274296&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-274296
]
ASF GitHub Bot logged work on BEAM-6740:
----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Jul/19 18:53
Start Date: 09/Jul/19 18:53
Worklog Time Spent: 10m
Work Description: youngoli commented on issue #8964: [BEAM-6740] Add
PTransformTranslator for Combine.Globally
URL: https://github.com/apache/beam/pull/8964#issuecomment-509763652
Yeah, the existing doc doesn't touch on `Combine.Globally` at all, but it's
essentially just `Combine.PerKey` with a global key. Once you've grouped all
elements under that global key I think you could just use
`COMBINE_GROUPED_VALUES`. (From what I remember combiner lifting isn't really
useful with a global combine but theoretically you could use the lifted version
of the expansion too.)
So I'd say a `Combine.Globally` can just expand to `GroupByGlobalKey` ->
`Combine.GroupedValues`, where `GroupByGlobalKey` is any transform that groups
all elements in an iterator under some arbitrary key. I don't know if a
transform like that exists in the Java SDK already, but it shouldn't be hard to
implement.
----------------------------------------------------------------
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: 274296)
Time Spent: 5h 20m (was: 5h 10m)
> Combine.Globally translation is never called
> --------------------------------------------
>
> Key: BEAM-6740
> URL: https://issues.apache.org/jira/browse/BEAM-6740
> Project: Beam
> Issue Type: Bug
> Components: runner-core
> Reporter: Etienne Chauchot
> Assignee: Ismaël Mejía
> Priority: Major
> Labels: portability
> Time Spent: 5h 20m
> Remaining Estimate: 0h
>
> Beam translates Combine.Globally as a composite transform composed of:
> * Map that assigns Void keys
> * Combine.PerKey
> on spark: As Combine.Perkey uses a spark GBK inside it, the runner adds its
> own translation of Combine.Globally to avoid less performant GBK. This
> translation should be called in place of entering the composite transform
> translation.A pipeline like this:
> {code:java}
> PCollection<Integer> input = pipeline.apply(Create.of(1, 2, 3, 4, 5, 6, 7, 8,
> 9, 10));
> input.apply(
> Combine.globally(new IntegerCombineFn()));
> {code}
> {code:java}
> private static class IntegerCombineFn extends Combine.CombineFn<Integer,
> Integer, Integer> {
> @Override
> public Integer createAccumulator() {
> return 0;
> }
> @Override
> public Integer addInput(Integer accumulator, Integer input) {
> return accumulator + input;
> }
> @Override
> public Integer mergeAccumulators(Iterable<Integer> accumulators) {
> Integer result = 0;
> for (Integer value : accumulators) {
> result += value;
> }
> return result;
> }
> @Override
> public Integer extractOutput(Integer accumulator) {
> return accumulator;
> }
> }
> {code}
> is translated as the above composite.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)