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

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

                Author: ASF GitHub Bot
            Created on: 17/Sep/18 19:47
            Start Date: 17/Sep/18 19:47
    Worklog Time Spent: 10m 
      Work Description: jklukas opened a new pull request #6414: [BEAM-5413] 
Add PTransform::compose for lambda-based composite transforms
URL: https://github.com/apache/beam/pull/6414
 
 
   This PR adds `PTransform::compose` which takes in a SerializableFunction, 
intended for use with a Java 8 lambda expression. This method gives users a 
more compact option for defining simple composite transforms.
   
   cc @lukecwik 
   
   ------------------------
   
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
    - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA 
issue, if applicable. This will automatically link the pull request to the 
issue.
    - [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   It will help us expedite review of your Pull Request if you tag someone 
(e.g. `@username`) to look at it.
   
   Post-Commit Tests Status (on master branch)
   
------------------------------------------------------------------------------------------------
   
   Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
   --- | --- | --- | --- | --- | --- | --- | ---
   Go | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/)
 | --- | --- | --- | --- | --- | ---
   Java | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark_Gradle/lastCompletedBuild/)
   Python | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/)
 | --- | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/)
 </br> [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/)
 | --- | --- | --- | ---
   
   
   
   
   

----------------------------------------------------------------
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: 145038)
            Time Spent: 10m
    Remaining Estimate: 0h

> Add method for defining composite transforms as lambda expressions
> ------------------------------------------------------------------
>
>                 Key: BEAM-5413
>                 URL: https://issues.apache.org/jira/browse/BEAM-5413
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Jeff Klukas
>            Assignee: Kenneth Knowles
>            Priority: Minor
>             Fix For: 2.8.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Defining a composite transform today requires writing a full named subclass 
> of PTransform (as [the programming guide 
> documents|[https://beam.apache.org/documentation/programming-guide/#composite-transforms]),]
>  but there are cases where users may want to define a fairly trivial 
> composite transform using a less verbose Java 8 lambda expression.
> Consider an example where the user has defined MyDeserializationTransform 
> that attempts to deserialize byte arrays into some object, returning a 
> PCollectionTuple  with tags for successfully deserialized records (mainTag) 
> and for errors (errorTag).
> If we introduce a PTransform::compose method that takes in a 
> SerializableFunction, the user can handle errors in a small lambda expression:
>  
> {code:java}
> byteArrays
>     .apply("attempt to deserialize messages", 
>         new MyDeserializationTransform())
>     .apply("write deserialization errors",
>         PTransform.compose((PCollectionTuple input) -> {
>             input
>               .get(errorTag)
>               .apply(new MyErrorOutputTransform());
>             return input.get(mainTag);
>         })
>     .apply("more processing on the deserialized messages", 
>          new MyOtherTransform())
> {code}
> This style allows a more concise and fluent pipeline definition than is 
> currently possible.
>  



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

Reply via email to