Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-11108] Add a version of TextIO implemented via SDF. #13188

Merged
merged 3 commits into from Oct 29, 2020

Conversation

youngoli
Copy link
Contributor

@youngoli youngoli commented Oct 24, 2020

Pretty straightforward. Read and ReadSdf should be functionally identical, and likewise for ReadAll and ReadAllSdf.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • 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.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Dataflow Flink Samza Spark Twister2
Go Build Status --- Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status --- Build Status --- Build Status ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status --- --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@youngoli
Copy link
Contributor Author

Run Go Postcommit

Pretty straightforward. Read and ReadSdf should be functionally identical, and likewise for ReadAll and ReadAllSdf.
@youngoli
Copy link
Contributor Author

R: @lostluck

@youngoli youngoli changed the title [DO NOT MERGE] [BEAM-11108] Add a version of TextIO implemented via SDF. [BEAM-11108] Add a version of TextIO implemented via SDF. Oct 26, 2020
Copy link
Contributor

@lostluck lostluck left a comment

Choose a reason for hiding this comment

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

LGTM I like this! Two test related comments.


// fakeReadSdfFn calls the methods in readSdfFn on a single input to simulate
// executing an SDF, and outputs all elements produced by that input.
func fakeReadSdfFn(t *testing.T, f string, size int64) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Notionally this kind of helper is a reason to have "real" SDF actuation on the Go Direct Runner, so testing the IOs is as simple as running a go direct pipeline.
That would be a good candidate for a separate JIRA on the topic as a subtask of BEAM-11076 if it doesn't already work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is available in the Direct runner, so I updated the test to use it. Not sure if I should also update the normal TextIO test too, but if so it should work just as well.

//
// Size should be greater than 0. Otherwise there is no way to split the
// restriction and this function will return the original restriction.
func (r Restriction) SizedSplits(size int64) (splits []Restriction) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a unit test, with the stated example, a "real world" example (largely with larger numbers involved, like the 64MB chunks used later in this PR), and edge cases, like exact splits, and off by 1 errors (both sides) etc (to validate that we don't somehow end up with 0 sized splits.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@lostluck lostluck left a comment

Choose a reason for hiding this comment

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

LGTM This is great! Very exciting.

size: 5,
want: []Restriction{{0, 5}, {5, 10}, {10, 11}},
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding an exact case too eg.
Start 7, End 17
size 5
{7, 12}, {12, 17}
IIUC the implementation correctly.
If I understand the

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that seems like a good idea. I'll add one more case before merging.

@youngoli youngoli merged commit ce190e1 into apache:master Oct 29, 2020
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.

None yet

2 participants