beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Groh (JIRA)" <>
Subject [jira] [Resolved] (BEAM-2493) TestStream.Builder.addElements() should return the same builder
Date Wed, 16 Aug 2017 20:43:00 GMT


Thomas Groh resolved BEAM-2493.
       Resolution: Not A Problem
    Fix Version/s: Not applicable

Existing PTransforms return new instances whenever their state is mutated. We decided to make
the builder follow this pattern.

Changing {{TestStream}} in this way is also backwards-incompatible; instances are no longer
independent when in partially constructed states.

> TestStream.Builder.addElements() should return the same builder
> ---------------------------------------------------------------
>                 Key: BEAM-2493
>                 URL:
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>    Affects Versions: 2.0.0
>            Reporter: Keith Berkoben
>            Assignee: Thomas Groh
>             Fix For: Not applicable
> When writing tests for pipelines, it is commonly the case where a TestStream must be
built in steps ex: 
> TestStream.Builder<Object> tsb = TestStream.create(<coder>).advanceWatermarkTo(new
> if(<a thing is true>){
>   tsb.addElements(<element>);
> }
> TestStream<Object>  stream = tsb.advanceWatermarkToInfinity();
> The above code does not  work, however, because addElements() is creating a NEW builder
rather than augmenting the existing one.  This is a-typical for a builder pattern and requires
the user to do 
> tsb = tsb.addElements()
> which is more verbose and counterintuitive if one is expecting a builder. 

This message was sent by Atlassian JIRA

View raw message