Skip to content

Conversation

@tgroh
Copy link
Member

@tgroh tgroh commented Apr 15, 2016

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify. (Even better, enable
    Travis-CI on your fork and ensure the whole test matrix passes).
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

This removes the requirement to implement a primtiive Create for runners
that support Reads from a Bounded Source.

Remove the override in the InProcessRunner

This is part of the new Beam Runner API, which removes Create as a primitive PTransform
https://docs.google.com/document/d/1bao-5B6uBuf-kwH1meenAuXXS0c9cBQ1B2J59I3FiyI/edit#heading=h.p6lvszfbmyj6

@tgroh tgroh force-pushed the create_as_a_source_always branch from 2059a01 to 54a5d1d Compare April 15, 2016 01:12
@tgroh
Copy link
Member Author

tgroh commented Apr 15, 2016

R: @dhalperi

@tgroh tgroh force-pushed the create_as_a_source_always branch from 54a5d1d to 1fd3c88 Compare April 15, 2016 21:14
@dhalperi
Copy link
Contributor

@tgroh not passing, will move on to other review ;)

This removes the requirement to implement a primtiive Create for runners
that support Reads from a Bounded Source.

Remove Dataflow Runner references to Create.Values
@tgroh tgroh force-pushed the create_as_a_source_always branch from 87883f1 to 9e154c4 Compare April 20, 2016 21:47
@tgroh
Copy link
Member Author

tgroh commented Apr 20, 2016

Tests are passing with #214 in the history.

PTAL.

@tgroh tgroh changed the title Implement Create as An OffsetBasedSource [BEAM-215] Implement Create as An OffsetBasedSource Apr 21, 2016
@Override
protected boolean advanceImpl() throws IOException {
CreateSource<T> source = getCurrentSource();
index++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set next to null here? So that getCurrent() throws the proper NoSuchElelementException.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@tgroh tgroh force-pushed the create_as_a_source_always branch from ae278d3 to 87fc494 Compare April 21, 2016 22:25
TestPipeline p = TestPipeline.create();
PCollection<Record> unencodable =
p.apply(Create.of(new Record()).withCoder(new RecordNoEncodeCoder()));
p.apply(Create.<Record>of().withCoder(new RecordNoEncodeCoder()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this more faithfully (or perhaps additionally) by adding a test with Create.of(t) -> ParDo.of(emit uncodable)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just refactor the common code to a utility method to make it clear what is being tested in this and below tests?

The key IIUC is that this is just a unit test of ModelEnforcement, and all of the setup code is just to get the ability to create bundles of the test record in the right way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored the setup code into a common location, less the success case, due to the need to create a proper InProcessTransformResult instance.

/**
* Tests for {@link InProcessCreate}.
*/
@RunWith(JUnit4.class)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the tests for existing Create this good or do you need to re-add these under the new name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About half of them. Anything based on the underlying source, + serializable elements needed to be ported (and now has been)

@dhalperi
Copy link
Contributor

LGTM, ping me when travis is green again and I can merge ;)

@tgroh tgroh force-pushed the create_as_a_source_always branch from ee876ae to 1c56762 Compare April 21, 2016 23:16
@asfgit asfgit closed this in a5548f9 Apr 22, 2016
swegner pushed a commit to swegner/beam that referenced this pull request Apr 22, 2016
iemejia pushed a commit to iemejia/beam that referenced this pull request Jan 12, 2018
mareksimunek pushed a commit to mareksimunek/beam that referenced this pull request May 9, 2018
added IOUtils to help iterate over methods throwing IOException
pl04351820 pushed a commit to pl04351820/beam that referenced this pull request Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants