This is an automated email from the ASF dual-hosted git repository.

pabloem 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 1b6ca617c24 Add example for `Distinct` PTransform
     new e4eda0e7395 Merge pull request #22417 from 
shhivam/add-example-java-distinct
1b6ca617c24 is described below

commit 1b6ca617c242bbfb7aa1cab835d16016f0cb7475
Author: Shivam <[email protected]>
AuthorDate: Sat Jul 23 01:11:17 2022 +0530

    Add example for `Distinct` PTransform
---
 .../transforms/java/aggregation/distinct.md            | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/website/www/site/content/en/documentation/transforms/java/aggregation/distinct.md
 
b/website/www/site/content/en/documentation/transforms/java/aggregation/distinct.md
index 412310b4ed3..3a7e6dbf011 100644
--- 
a/website/www/site/content/en/documentation/transforms/java/aggregation/distinct.md
+++ 
b/website/www/site/content/en/documentation/transforms/java/aggregation/distinct.md
@@ -32,7 +32,23 @@ answer using `ApproximateUnique`, which also allows for 
determining distinct
 values for each key.
 
 ## Examples
-See [BEAM-7703](https://issues.apache.org/jira/browse/BEAM-7703) for updates.
+
+**Example 1** Find the distinct element from a `PCollection` of `String`.
+
+{{< highlight java >}}
+
+static final String[] WORDS_ARRAY = new String[]{
+            "hi", "hi", "sue",
+            "sue",  "bob"
+    };
+static final List<String> WORDS = Arrays.asList(WORDS_ARRAY);
+
+PCollection<String> input =
+        pipeline.apply(Create.of(WORDS)).withCoder(StringUtf8Coder.of());
+
+PCollection<String> distinctWords = input.apply(Distinct.create());
+
+{{< /highlight >}}
 
 ## Related transforms
 * [Count](/documentation/transforms/java/aggregation/count)

Reply via email to