You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kenneth Knowles (JIRA)" <ji...@apache.org> on 2019/03/30 01:51:04 UTC

[jira] [Commented] (BEAM-6740) Combine.globally translation is never called

    [ https://issues.apache.org/jira/browse/BEAM-6740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16805587#comment-16805587 ] 

Kenneth Knowles commented on BEAM-6740:
---------------------------------------

I think you should just add a URN for Combine.globally. That seems useful. Any transform that has well-defined semantics can and should have a URN. It is valuable in many ways:

 - if a runner has a special implementation (like yours) it can choose that and run zero user code
 - if there are multiple languages in a pipeline, the runner can choose the language with the most advantageous fusion to implement the URN

A URN does not just apply to primitives, and there is no requirement that any SDK implement anything except the primitives SDK harness URNs. It is just a hint.

> 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
>          Time Spent: 40m
>  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)