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

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

                Author: ASF GitHub Bot
            Created on: 21/Sep/18 23:34
            Start Date: 21/Sep/18 23:34
    Worklog Time Spent: 10m 
      Work Description: HuangLED commented on a change in pull request #6439: 
[BEAM-5427] Fix and update sample code for CombineFn.
URL: https://github.com/apache/beam/pull/6439#discussion_r219650411
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Combine.java
 ##########
 @@ -289,6 +305,21 @@ private Combine() {
    * arbitrary tree structure. Commutativity is required because any order of 
the input values is
    * ignored when breaking up input values into groups.
    *
+   * <h3>Note on Data Encoding</h3>
+   *
+   * <p>Data encoding is required to make CombineFn work. The sample code 
above implements {@code
+   * java.io.Serializable} so that CombineFn in consequence makes use of 
SerializableCoder to encode
+   * the data. In many cases though, relying on Serializable could be less 
preferred for efficiency
+   * considerations. In addition, Serializable may not be applicable in all 
situations. There are
+   * two alternatives to make data encoding work for AverageFn:
+   *
+   * <ul>
+   *   <li>Generic Coder class. Implement an encoder class explicitly and use 
{@code @DefaultCoder}
+   *       tag.
+   *   <li>{@link CombineFn} Specific way. While extending {@link CombineFn}, 
overwrite both {@link
+   *       #getAccumulatorCoder} and {@link #getDefaultOutputCoder}.
+   * </ul>
+   *
 
 Review comment:
   oops.  I was trying to consolidate commits for cleaner history. But looks 
like history is now gone. 

----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 146639)
    Time Spent: 2h  (was: 1h 50m)

> Fix sample code (AverageFn) in Combine.java
> -------------------------------------------
>
>                 Key: BEAM-5427
>                 URL: https://issues.apache.org/jira/browse/BEAM-5427
>             Project: Beam
>          Issue Type: Improvement
>          Components: examples-java
>            Reporter: Ruoyun Huang
>            Assignee: Ruoyun Huang
>            Priority: Minor
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Sample code missing coder. 
> In its current state, job run fails with Coder missing error. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to