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

ASF GitHub Bot commented on BEAM-742:
-------------------------------------

GitHub user kennknowles opened a pull request:

    https://github.com/apache/incubator-beam/pull/1101

    [BEAM-742] Translation from Trigger to TriggerStateMachine

    Be sure to do all of the following to help us incorporate your contribution
    quickly and easily:
    
     - [x] Make sure the PR title is formatted like:
       `[BEAM-<Jira issue #>] Description of pull request`
     - [x] Make sure tests pass via `mvn clean verify`. (Even better, enable
           Travis-CI on your fork and ensure the whole test matrix passes).
     - [x] Replace `<Jira issue #>` in the title with the actual Jira issue
           number, if there is one.
     - [x] If this contribution is large, please file an Apache
           [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.txt).
    
    ---
    
    This add a `TriggerStateMachines` utility class to `runners-core` with one 
key piece of functionality: converting a `Trigger` (where we pretend it is just 
a piece of syntax) to a `TriggerStateMachine` (which is just a copy of what 
triggers currently are).
    
    In doing so, a fairly large number of trivial accessors and private/public 
alteration were necessary to the existing trigger codebase, but no 
functionality changes.
    
    It is worth noting briefly the options for disjoint unions in Java, to 
explain why I chose the one I did:
    
    1. A binder/evaluator a la `StateBinder` (this is the super-type-safe way 
of doing data in Java) but that adds a non-user-facing method to the interface. 
It can be useful sometimes, such as the way that `StateTag` has a phantom type 
that gets propagated to the return type of the visitor.
    2. A visitor a la `PipelineVisitor` that just mutates some internal state. 
This is roughly the same as the prior, but returning `void` and mutating makes 
it easier to return complex data but forces an ordering.
    3. Using reflection to treat the Java class as the disjoint union tag. This 
is the approach taken by Scala, and the approach I take here. I tried to 
minimize the reflective boilerplate this induced. No type safety is really 
lost, since in the technical vision, this trigger will be an AST sent over the 
wire (aka no type safety is available).
    
    R: @bjchambers 


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kennknowles/incubator-beam 
TriggerReactor-conversion

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-beam/pull/1101.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1101
    
----
commit a931626554f48197d733a8793e42dd18abcdb36f
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:08:53Z

    Make Trigger#subTriggers public and non-null

commit 409e6b77abc59ac9dff19d155d4485d70e1cfc60
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:42:38Z

    Construct AfterAllStateMachine with a list of subtriggers

commit 12ab0cee39004877ee2d20778d8768966399919e
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:43:08Z

    Construct AfterFirstStateMachine with a list of subtriggers

commit 6c0b307719cdf8a6a45a3b6f1e82cff88d1d10bb
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:43:33Z

    Make AfterSynchronizedProcessingTime public
    
    We need to be able to access this class to reason about it when
    converting a trigger to a state machine.

commit 3cdd843b6498b2c5ac227ea3dc8be09d64b1c8b0
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:44:35Z

    Add direct accessors for the components of OrFinallyTrigger

commit 22527bb34708059327f63dccdac3ad4a69bda6ed
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:56:54Z

    Construct AfterEachStateMachine from list of subtriggers

commit 1ad53cb68c76452db1ccbc64d55b92fe14db0e48
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:57:48Z

    Add accessors to Repeatedly trigger

commit ebb8e63b650d2dc9e43ac23d11ef1b3be1d6ac6c
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:58:12Z

    Make OrFinallyTrigger public so it can be examined

commit 40277691f64861a622fbd9bddf0ad1d8963d64ca
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T04:13:27Z

    Add accessors to AfterWatermark trigger

commit a5bac7bea8f8d82d14f7c341b4757c6a9a40bddf
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T05:13:43Z

    Add access to values from AfterDelay triggers

commit e95f5945d2469a44218dd3ad6f40afb5dce094e4
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T05:14:32Z

    Add accessors for AfterPane(StateMachine) parameters

commit b1d7222f9c26c0e5456d5cb4f423a707b47112a5
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T05:15:32Z

    Make return types of trigger static factory methods precise
    
    This is helpful in testing and loses no abstraction - the code
    locations calling these methods already know the more-specific
    type that will be returned.

commit edf6f80b0e32bef5a6217668cf527652648ae861
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T05:17:14Z

    Accessors for AfterDelay

commit d65c47698747f28100dd3501c3ced65d371b6aec
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T05:17:26Z

    Make NeverTrigger public for translation

commit 6ea617ae8c2b1cb63f38ec4f08c8dbda69766099
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T05:46:08Z

    Make return types more precise for AfterWatermarkTriggerStateMachine

commit 4bc2ba5dbd25e7b320253cc6c9e635accbe260de
Author: Kenneth Knowles <k...@google.com>
Date:   2016-10-14T03:02:52Z

    Add TriggerStateMachines with conversion from Trigger

----


> Move trigger state machines to runners-core, convert triggers to AST
> --------------------------------------------------------------------
>
>                 Key: BEAM-742
>                 URL: https://issues.apache.org/jira/browse/BEAM-742
>             Project: Beam
>          Issue Type: Sub-task
>          Components: runner-core, sdk-java-core
>            Reporter: Kenneth Knowles
>            Assignee: Kenneth Knowles
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to