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-4255] Set singleton view writers' accumulation mode to discarding #5311

Closed
wants to merge 1 commit into from

Conversation

huygaa11
Copy link
Contributor

@huygaa11 huygaa11 commented May 8, 2018

The code snippet below was writing multiple values to the sideInput, resulting in exception: "PCollection with more than one element accessed as a singleton view."

PCollectionView globalView = input
.apply(Window.into(new GlobalWindows())
.triggering(Repeatedly.forever(AfterPane.elementCountAtLeast(1)))
.accumulatingFiredPanes())
.apply(Sum.integersGlobally().asSingletonView())

This PR sets the accumulation mode to discarding for singleton view writer, so that the GBK's used by view writers do not accumulate combine results.


Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand:
    • What the pull request does
    • Why it does it
    • How it does it
    • Why this approach
  • Each commit in the pull request should have a meaningful subject line and body.
  • Run ./gradlew build to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@huygaa11
Copy link
Contributor Author

huygaa11 commented May 8, 2018

@tgroh could you review this, please?

@@ -1283,6 +1283,10 @@ private GloballyAsSingletonView(
insertDefault,
insertDefault ? fn.defaultValue() : null,
combined.getCoder());

// GBK's inside view writers for singleton view should discard previous values.
materializationInput.setWindowingStrategyInternal(input.getWindowingStrategy()
Copy link
Member

Choose a reason for hiding this comment

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

You should instead use Window.configure().discardingFiredPanes(), explicitly setting any other required values from the upstream WindowingStrategy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Window.configure() does not seem to work. I will take a little break from this bug and re-visit it soon.

@huygaa11
Copy link
Contributor Author

run java precommit

@huygaa11 huygaa11 closed this May 24, 2018
@huygaa11
Copy link
Contributor Author

Using singletonView with Combine is generally flawed. Not continuing this PR

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