Use input type in coder inference for MapElements and FlatMapElements#757
Conversation
055654b to
2a3d894
Compare
|
A bit of flavor on the motivation by this change, which might otherwise look bigger than it needs to be:
So this is my best approach to getting a good |
|
R: @bjchambers AND @swegner |
|
Looks like these same change appears in #756; I've added comments there. |
5271795 to
9777ade
Compare
|
Thanks to your comments in #756, I've fixed this one up. They are now disjoint, but this one will have to merge first. |
4a8a882 to
aa7524d
Compare
| @Override | ||
| public List<Integer> apply(Integer input) { | ||
| return Collections.emptyList(); | ||
| } |
There was a problem hiding this comment.
Can you update these tests to also verify display data items from the SimpleFunction are registered? i.e., add a populateDisplayData() override to add some display data and make sure it gets wired through.
There was a problem hiding this comment.
Ah, nevermind I see you moved that the a separate PR.
|
|
|
Pinging @bjchambers for binding LGTM |
|
Travis failure is timeout. |
aa7524d to
71e7348
Compare
|
Rebased to kick Travis. |
| pipeline.run(); | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
It seems like there should be tests for the "propagate input coder to output" logic in at least a few diffferent cases T -> T, T -> Iterable, etc.
71e7348 to
714a218
Compare
| * A {@link SimpleFunction} to test that the coder registry can propagate coders | ||
| * that are bound to type variables. | ||
| */ | ||
| private static class PolymorphicSimpleFunction<T> extends SimpleFunction<T, Iterable<T>> { |
There was a problem hiding this comment.
We could also play with a few other simple functions:
SimpleFunction<T, T>
SimpleFunction<Iterable, T> <- wouldn't expect this to work?
|
Jenkins is red. |
714a218 to
db57ce1
Compare
|
Jenkins rightly took issue with a poorly place linebreak. Fixed. |
1ec5770 to
00bbb0a
Compare
|
Rebased onto the new |
00bbb0a to
2d700de
Compare
f8533ad to
4ac5caf
Compare
Previously, the input TypeDescriptor was unknown, so we would fail to infer a coder for things like MapElements.of(SimpleFunction<T, T>) even if the input PCollection provided a coder for T. Now, the input type is plumbed appropriately and the coder is inferred.
* docs: Minor formatting chore: Update gapic-generator-python to v1.11.5 build: Update rules_python to 0.24.0 PiperOrigin-RevId: 563436317 Source-Link: googleapis/googleapis@42fd37b Source-Link: https://github.com/googleapis/googleapis-gen/commit/280264ca02fb9316b4237a96d0af1a2343a81a56 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjgwMjY0Y2EwMmZiOTMxNmI0MjM3YTk2ZDBhZjFhMjM0M2E4MWE1NiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Victor Chudnovsky <vchudnov@google.com> Co-authored-by: Daniel Sanche <sanche@google.com>
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
[BEAM-<Jira issue #>] Description of pull requestmvn clean verify. (Even better, enableTravis-CI on your fork and ensure the whole test matrix passes).
<Jira issue #>in the title with the actual Jira issuenumber, if there is one.
Individual Contributor License Agreement.
It seems that PR #756 triggered some very strange serialization issues with regards to lambda (https://builds.apache.org/job/beam_PreCommit_MavenVerify/2610/console). To isolate them, I went through the conflicts and peeled this commit off the top. Description follows:
Previously, the input
TypeDescriptorwas unknown, so we would fail to infer a coder for things likeMapElements.of(SimpleFunction<T, T>)even if the inputPCollectionprovided a coder forT.Now, the input type is plumbed appropriately and the coder is inferred.
This required internal changes to explicitly support good display data (tests fail with a naive refactor). While doing this, I just added display data to
SimpleFunctionby analogy withDoFn.