GitHub user youngoli opened a pull request: https://github.com/apache/beam/pull/3922
[BEAM-2989] Fixed error when using Void type in WithKeys. Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/projects/BEAM/issues/) 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. - [x] Each commit in the pull request should have a meaningful subject line and body. - [x] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Run `mvn clean verify` 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](https://www.apache.org/licenses/icla.pdf). --- `WithKeys` had trouble correctly getting a `VoidCoder` when called with a null input before. This fix makes it so that it now functions when the input is `(Void) null`. This is done by passing Void.class as the key's class type instead of null, if the inputted key was null. Note that a null input that isn't cast to Void calls the `WithKeys.of` taking a `SerializableFunction` instead, so I added a precondition with a warning message to that one. Also added a unit test to confirm that the fix works as intended, a quick change to `VoidCoder` to ensure that it doesn't get used inappropriately, and fixed a few warnings in `WithKeysTest`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/youngoli/beam bug-2989 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/beam/pull/3922.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3922 ---- commit 97fa1f0e10f0cdfb4c6dff54e39230da41478d19 Author: Daniel Oliveira <daniel.o.program...@gmail.com> Date: 2017-09-29T21:10:00Z [BEAM-2989] Fixed error when using Void type in WithKeys. Also added error messages to WithKeys.of and VoidCoder.encode. ---- ---