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-9877] Estimate sizes of group-by-key values behind a key lazily only. #11598

Merged
merged 7 commits into from
May 4, 2020

Conversation

tudorm
Copy link
Contributor

@tudorm tudorm commented May 4, 2020

Perform lazy estimation only for such iterables since they can have enormous sizes and size estimates would cause reading the data multiple times.


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 Apex Dataflow Flink Gearpump Samza Spark
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
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable 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.

… such iterables can have enormous sizes and size estimates would cause reading the data multiple times. Furthermore, the size of the entire group-by-key collection is already known precisely at read time (and encoded into corresponding counters), which means the estimation is in fact not only expensive but redundant and unnecessary.
@tudorm
Copy link
Contributor Author

tudorm commented May 4, 2020

R: @kennknowles
R: @lukecwik

@lukecwik
Copy link
Member

lukecwik commented May 4, 2020

retest this please

@lukecwik
Copy link
Member

lukecwik commented May 4, 2020

How will this impact PCollection size estimation shown in the Dataflow UI?

@tudorm
Copy link
Contributor Author

tudorm commented May 4, 2020 via email

@tudorm
Copy link
Contributor Author

tudorm commented May 4, 2020

Updated the change to perform lazy estimation instead of side-stepping the estimation altogether.

@tudorm tudorm changed the title Do not attempt to estimate sizes of group-by-key values behind a key. [BEAM-9877] Estimate sizes of group-by-key values behind a key lazily only. May 4, 2020
@lukecwik
Copy link
Member

lukecwik commented May 4, 2020

retest this please

Copy link
Contributor

@ibzib ibzib left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -165,12 +168,17 @@ public WindowReiterable(
}

@Override
public Reiterator<V> iterator() {
public WindowReiterator<V> iterator() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's odd that ElementByteSizeObservableIterable::iterator adds observers within the method body. I assume this is for historic reasons, since it doesn't seem to do anything now, and the comment documenting references a setObserver method that doesn't exist. Anyway, your change looks fine. But we should consider cleaning this up.

/**
* Returns a new iterator for this iterable. If an observer was set in a previous call to
* setObserver(), it will observe the iterator returned.
*/
@Override
public InputT iterator() {
InputT iterator = createIterator();
for (Observer observer : observers) {
iterator.addObserver(observer);
}
observers.clear();
return iterator;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I filed BEAM-9878 as a wish item.

@tudorm
Copy link
Contributor Author

tudorm commented May 4, 2020

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants