beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From al...@apache.org
Subject [beam] branch master updated: [BEAM-7390] Add distinct code snippets
Date Thu, 23 Jul 2020 23:28:13 GMT
This is an automated email from the ASF dual-hosted git repository.

altay 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 a2dac5c  [BEAM-7390] Add distinct code snippets
     new 55dfb55  Merge pull request #12356 from davidcavazos/distinct-docs
a2dac5c is described below

commit a2dac5c84e4a3b40643bb7dd3a79e48dfd1a9780
Author: David Cavazos <dcavazos@google.com>
AuthorDate: Thu Jul 23 11:52:06 2020 -0700

    [BEAM-7390] Add distinct code snippets
---
 .../transforms/python/aggregation/distinct.md      | 37 +++++++++++++++-------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/website/www/site/content/en/documentation/transforms/python/aggregation/distinct.md
b/website/www/site/content/en/documentation/transforms/python/aggregation/distinct.md
index 067c009..e0abca4 100644
--- a/website/www/site/content/en/documentation/transforms/python/aggregation/distinct.md
+++ b/website/www/site/content/en/documentation/transforms/python/aggregation/distinct.md
@@ -16,21 +16,36 @@ limitations under the License.
 -->
 
 # Distinct
-<table align="left">
-    <a target="_blank" class="button"
-        href="https://beam.apache.org/releases/pydoc/current/apache_beam.transforms.util.html#apache_beam.transforms.util.Distinct">
-      <img src="https://beam.apache.org/images/logos/sdks/python.png" width="20px" height="20px"
-           alt="Pydoc" />
-     Pydoc
-    </a>
-</table>
-<br><br>
 
+{{< localstorage language language-py >}}
+
+{{< button-pydoc path="apache_beam.transforms.util" class="Distinct" >}}
 
 Produces a collection containing distinct elements of the input collection.
 
 ## Examples
-See [BEAM-7390](https://issues.apache.org/jira/browse/BEAM-7390) for updates. 
+
+In the following example, we create a pipeline with two `PCollection`s of produce.
+
+We use `Distinct` to get rid of duplicate elements, which outputs a `PCollection` of all
the unique elements.
+
+{{< highlight py >}}
+{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/aggregation/distinct.py"
distinct >}}
+{{< /highlight >}}
+
+{{< paragraph class="notebook-skip" >}}
+Output:
+{{< /paragraph >}}
+
+{{< highlight class="notebook-skip" >}}
+{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/aggregation/distinct_test.py"
unique_elements >}}
+{{< /highlight >}}
+
+{{< buttons-code-snippet
+  py="sdks/python/apache_beam/examples/snippets/transforms/aggregation/distinct.py" >}}
 
 ## Related transforms
-* [Count](/documentation/transforms/python/aggregation/count) counts the number of elements
within each aggregation.
\ No newline at end of file
+
+* [Count](/documentation/transforms/python/aggregation/count) counts the number of elements
within each aggregation.
+
+{{< button-pydoc path="apache_beam.transforms.util" class="Distinct" >}}


Mime
View raw message