This is an automated email from the ASF dual-hosted git repository.
bhulette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 52dd5a5effc [BEAM-14320] Update programming-guide w/Java GroupByKey
example (#17369)
52dd5a5effc is described below
commit 52dd5a5effcb0f0bee1dcc7556a65b5a3ed342fb
Author: Denise Case <[email protected]>
AuthorDate: Mon Apr 25 13:41:04 2022 -0500
[BEAM-14320] Update programming-guide w/Java GroupByKey example (#17369)
* Update programming-guide w/Java GroupByKey example
Added the following content to provide a Java example at the end of section
4.2.2. GroupByKey.
Using <span class="language-java">`GroupByKey`</span> is straightforward:
{{< highlight java >}}
// The input PCollection.
PCollection<KV<String, String>> mapped = ...;
// Apply GroupByKey to the PCollection mapped.
// Save the result as the PCollection reduced.
PCollection<KV<String, Iterable<String>>> reduced =
mapped.apply(GroupByKey.<String, String>create());
{{< /highlight >}}
* Update programming-guide w/GroupByKey example
Fixed whitespace issues
* Update programming-guide: GroupByKey ex. only Java
* Moved closing java span tag as requested
---
.../www/site/content/en/documentation/programming-guide.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/website/www/site/content/en/documentation/programming-guide.md
b/website/www/site/content/en/documentation/programming-guide.md
index 998be6fcaeb..fccf4b98b37 100644
--- a/website/www/site/content/en/documentation/programming-guide.md
+++ b/website/www/site/content/en/documentation/programming-guide.md
@@ -1100,6 +1100,18 @@ tree, [2]
Thus, `GroupByKey` represents a transform from a multimap (multiple keys to
individual values) to a uni-map (unique keys to collections of values).
+<span class="language-java">Using `GroupByKey` is straightforward:</span>
+
+{{< highlight java >}}
+// The input PCollection.
+ PCollection<KV<String, String>> mapped = ...;
+
+// Apply GroupByKey to the PCollection mapped.
+// Save the result as the PCollection reduced.
+PCollection<KV<String, Iterable<String>>> reduced =
+ mapped.apply(GroupByKey.<String, String>create());
+{{< /highlight >}}
+
##### 4.2.2.1 GroupByKey and unbounded PCollections
{#groupbykey-and-unbounded-pcollections}
If you are using unbounded `PCollection`s, you must use either [non-global