[
https://issues.apache.org/jira/browse/BEAM-2493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
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: https://issues.apache.org/jira/browse/BEAM-2493
> 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 Instant(0);
> 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
(v6.4.14#64029)