Skip to content

Conversation

@tgroh
Copy link
Member

@tgroh tgroh commented Apr 20, 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 checks to ensure that the PCollectionView in the SideInputWindow
for the provided window either has elements available or is empty.

Schedule a future to ensure that the SideInputWindows are appropriately
filled with an empty iterable after retreiving the element.

This is allows the ParDoEvaluator to not attempt to process elements
that cannot currently be completed.

This checks to ensure that the PCollectionView in the SideInputWindow
for the provided window either has elements available or is empty.

Schedule a future to ensure that the SideInputWindows are appropriately
filled with an empty iterable after retreiving the element.
@tgroh tgroh force-pushed the ippr_side_input_is_ready branch from ffc47d7 to ab26b17 Compare April 20, 2016 21:53
@tgroh
Copy link
Member Author

tgroh commented Apr 20, 2016

R: @kennknowles @peihe

for (PCollectionView<?> view : readerViews) {
try {
BoundedWindow viewWindow =
view.getWindowingStrategyInternal().getWindowFn().getSideInputWindow(elementWindow);
Copy link
Contributor

@peihe peihe Apr 21, 2016

Choose a reason for hiding this comment

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

I feel the conversion from the main input window to the side input window doesn't belong to the side input reader.
allViewsReadyInWindow(mainWindow) is not consistent with get(...) method.

Copy link
Member Author

Choose a reason for hiding this comment

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

isReady(view, sideInputWindow) is symmetric with get(view, sideInputWindow). Changed to that.

try {
Future<Iterable<? extends WindowedValue<?>>> viewContents =
getViewFuture(view, window);
if (!viewContents.isDone()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

return viewContents.isDone();
and remove return true at the very end

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

* contents if necessary.
*/
private <T> Future<Iterable<? extends WindowedValue<?>>> getViewFuture(
final PCollectionView<T> view, final BoundedWindow window) throws ExecutionException {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you wrap ExecutionException into a RuntimeException here, you can avoid to do it twice outside.

Copy link
Member Author

Choose a reason for hiding this comment

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

Using getUnchecked - our CacheLoader will never throw an exception.

+ "Contained views; %s",
view,
readerViews);
Future<Iterable<? extends WindowedValue<?>>> viewContents = getViewFuture(view, window);
Copy link
Contributor

Choose a reason for hiding this comment

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

inline?
return getViewFuture(view, window).isDone();

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.

@peihe
Copy link
Contributor

peihe commented Apr 21, 2016

LGTM

@tgroh
Copy link
Member Author

tgroh commented Apr 21, 2016

@kennknowles for committer

}

@Test
public void isReadyForSomeNotReadyViewsFalseUntilElements() {
Copy link
Member

Choose a reason for hiding this comment

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

javadoc this a little bit so one has context when parsing the test

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.

@kennknowles
Copy link
Member

LGTM, merging.

iemejia pushed a commit to iemejia/beam that referenced this pull request Jan 12, 2018
pl04351820 pushed a commit to pl04351820/beam that referenced this pull request Dec 20, 2023
Co-authored-by: Tres Seaver <tseaver@palladion.com>
Co-authored-by: Christopher Wilcox <crwilcox@google.com>
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.

3 participants