beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [beam] branch asf-site updated: Publishing website 2020/08/07 18:02:32 at commit f6637f7
Date Fri, 07 Aug 2020 18:02:46 GMT
This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new f71a5aa  Publishing website 2020/08/07 18:02:32 at commit f6637f7
f71a5aa is described below

commit f71a5aac36c82b8d1b7fc7fbeede842a27a80269
Author: jenkins <users@infra.apache.org>
AuthorDate: Fri Aug 7 18:02:32 2020 +0000

    Publishing website 2020/08/07 18:02:32 at commit f6637f7
---
 .../transforms/python/aggregation/top/index.html   | 98 +++++++++++++++++++++-
 website/generated-content/sitemap.xml              |  2 +-
 2 files changed, 96 insertions(+), 4 deletions(-)

diff --git a/website/generated-content/documentation/transforms/python/aggregation/top/index.html
b/website/generated-content/documentation/transforms/python/aggregation/top/index.html
index 533e0de..2ad5ef6 100644
--- a/website/generated-content/documentation/transforms/python/aggregation/top/index.html
+++ b/website/generated-content/documentation/transforms/python/aggregation/top/index.html
@@ -1,10 +1,102 @@
 <!doctype html><html lang=en class=no-js><head><meta charset=utf-8><meta
http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>Top</title><meta
name=description content="Apache Beam is an open source, unified model and set of language-specific
SDKs for defining and executing data processing workflows, and also data ingestion and integration
flows, supporting Enterprise Integration Patterns (EIPs) and Domain Specific Languages [...]
 <span class=sr-only>Toggle navigation</span>
 <span class=icon-bar></span><span class=icon-bar></span><span
class=icon-bar></span></button>
-<a href=/ class=navbar-brand><img alt=Brand style=height:25px src=/images/beam_logo_navbar.png></a></div><div
class="navbar-mask closed"></div><div id=navbar class="navbar-container closed"><ul
class="nav navbar-nav"><li><a href=/get-started/beam-overview/>Get Started</a></li><li><a
href=/documentation/>Documentation</a></li><li><a href=/documentation/sdks/java/>Languages</a></li><li><a
href=/documentation/runners/capability-matrix/>RUNNERS</a></li><li><a
href=/roadmap/>Roadmap</a></li>< [...]
-Pydoc</a></table><br><br><p>Transforms for finding the largest
(or smallest) set of elements in
+<a href=/ class=navbar-brand><img alt=Brand style=height:25px src=/images/beam_logo_navbar.png></a></div><div
class="navbar-mask closed"></div><div id=navbar class="navbar-container closed"><ul
class="nav navbar-nav"><li><a href=/get-started/beam-overview/>Get Started</a></li><li><a
href=/documentation/>Documentation</a></li><li><a href=/documentation/sdks/java/>Languages</a></li><li><a
href=/documentation/runners/capability-matrix/>RUNNERS</a></li><li><a
href=/roadmap/>Roadmap</a></li>< [...]
+Pydoc</a></td></table><p><br><br><br></p><p>Transforms
for finding the largest (or smallest) set of elements in
 a collection, or the largest (or smallest) set of values associated
-with each key in a collection of key-value pairs.</p><h2 id=examples>Examples</h2><p>See
<a href=https://issues.apache.org/jira/browse/BEAM-7390>BEAM-7390</a> for updates.</p><h2
id=related-transforms>Related transforms</h2><ul><li><a href=/documentation/transforms/python/aggregation/sample>Sample</a>
to combine elements. takes samples of the elements in a collection.</li></ul></div></div><footer
class=footer><div class=footer__contained><div class=footer__cols><div class=footer__cols__c
[...]
+with each key in a collection of key-value pairs.</p><h2 id=examples>Examples</h2><p>In
the following example, we create a pipeline with a <code>PCollection</code>.
+Then, we get the largest or smallest elements in different ways.</p><h3 id=example-1-largest-elements-from-a-pcollection>Example
1: Largest elements from a PCollection</h3><p>We use <code>Top.Largest()</code>
to get the largest elements from the <em>entire</em> <code>PCollection</code>.</p><div
class=language-py><div class=highlight><pre class=chroma><code class=language-py
data-lang=py><span class=kn>import</span> <span class=nn>apache_beam</span>
<span class=kn>as</span> <span class=nn [...]
+
+<span class=k>with</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Pipeline</span><span class=p>()</span> <span class=k>as</span>
<span class=n>pipeline</span><span class=p>:</span>
+  <span class=n>largest_elements</span> <span class=o>=</span> <span
class=p>(</span>
+      <span class=n>pipeline</span>
+      <span class=o>|</span> <span class=s1>&#39;Create numbers&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>Create</span><span class=p>([</span><span
class=mi>3</span><span class=p>,</span> <span class=mi>4</span><span
class=p>,</span> <span class=mi>1</span><span class=p>,</span>
<span class=mi>2</span><span class=p>])</span>
+      <span class=o>|</span> <span class=s1>&#39;Largest N values&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>combiners</span><span class=o>.</span><span
class=n>Top</span><span class=o>.</span><span class=n>Largest</span><span
class=p>(</span><span class=mi>2</span><span class=p>)</span>
+      <span class=o>|</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Map</span><span class=p>(</span><span class=k>print</span><span
class=p>))</span></code></pre></div></div><p class=notebook-skip>Output:</p><div
class=notebook-skip><pre><code>[4, 3]</code></pre></div><table
align=left style=margin-right:1em class=.language-py><td><a class=button target=_blank
href=https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/aggreg
[...]
+
+<span class=k>with</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Pipeline</span><span class=p>()</span> <span class=k>as</span>
<span class=n>pipeline</span><span class=p>:</span>
+  <span class=n>largest_elements_per_key</span> <span class=o>=</span>
<span class=p>(</span>
+      <span class=n>pipeline</span>
+      <span class=o>|</span> <span class=s1>&#39;Create produce&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>Create</span><span class=p>([</span>
+          <span class=p>(</span><span class=s1>&#39;🥕&#39;</span><span
class=p>,</span> <span class=mi>3</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🥕&#39;</span><span
class=p>,</span> <span class=mi>2</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍆&#39;</span><span
class=p>,</span> <span class=mi>1</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍅&#39;</span><span
class=p>,</span> <span class=mi>4</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍅&#39;</span><span
class=p>,</span> <span class=mi>5</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍅&#39;</span><span
class=p>,</span> <span class=mi>3</span><span class=p>),</span>
+      <span class=p>])</span>
+      <span class=o>|</span> <span class=s1>&#39;Largest N values per
key&#39;</span> <span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>combiners</span><span class=o>.</span><span
class=n>Top</span><span class=o>.</span><span class=n>LargestPerKey</span><span
class=p>(</span><span class=mi>2</span><span class=p>)</span>
+      <span class=o>|</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Map</span><span class=p>(</span><span class=k>print</span><span
class=p>))</span></code></pre></div></div><p class=notebook-skip>Output:</p><div
class=notebook-skip><pre><code>(&#39;🥕&#39;, [3, 2])
+(&#39;🍆&#39;, [1])
+(&#39;🍅&#39;, [5, 4])</code></pre></div><table align=left
style=margin-right:1em class=.language-py><td><a class=button target=_blank href=https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/aggregation/top.py><img
src=https://www.tensorflow.org/images/GitHub-Mark-32px.png width=32px height=32px alt="View
source code"> View source code</a></td></table><p><br><br><br></p><h3
id=example-3-smallest-elements-from-a-pcollection>Example 3: Smallest e [...]
+
+<span class=k>with</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Pipeline</span><span class=p>()</span> <span class=k>as</span>
<span class=n>pipeline</span><span class=p>:</span>
+  <span class=n>smallest_elements</span> <span class=o>=</span> <span
class=p>(</span>
+      <span class=n>pipeline</span>
+      <span class=o>|</span> <span class=s1>&#39;Create numbers&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>Create</span><span class=p>([</span><span
class=mi>3</span><span class=p>,</span> <span class=mi>4</span><span
class=p>,</span> <span class=mi>1</span><span class=p>,</span>
<span class=mi>2</span><span class=p>])</span>
+      <span class=o>|</span> <span class=s1>&#39;Smallest N values&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>combiners</span><span class=o>.</span><span
class=n>Top</span><span class=o>.</span><span class=n>Smallest</span><span
class=p>(</span><span class=mi>2</span><span class=p>)</span>
+      <span class=o>|</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Map</span><span class=p>(</span><span class=k>print</span><span
class=p>))</span></code></pre></div></div><p class=notebook-skip>Output:</p><div
class=notebook-skip><pre><code>[1, 2]</code></pre></div><table
align=left style=margin-right:1em class=.language-py><td><a class=button target=_blank
href=https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/aggreg
[...]
+
+<span class=k>with</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Pipeline</span><span class=p>()</span> <span class=k>as</span>
<span class=n>pipeline</span><span class=p>:</span>
+  <span class=n>smallest_elements_per_key</span> <span class=o>=</span>
<span class=p>(</span>
+      <span class=n>pipeline</span>
+      <span class=o>|</span> <span class=s1>&#39;Create produce&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>Create</span><span class=p>([</span>
+          <span class=p>(</span><span class=s1>&#39;🥕&#39;</span><span
class=p>,</span> <span class=mi>3</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🥕&#39;</span><span
class=p>,</span> <span class=mi>2</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍆&#39;</span><span
class=p>,</span> <span class=mi>1</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍅&#39;</span><span
class=p>,</span> <span class=mi>4</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍅&#39;</span><span
class=p>,</span> <span class=mi>5</span><span class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;🍅&#39;</span><span
class=p>,</span> <span class=mi>3</span><span class=p>),</span>
+      <span class=p>])</span>
+      <span class=o>|</span> <span class=s1>&#39;Smallest N values
per key&#39;</span> <span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>combiners</span><span class=o>.</span><span
class=n>Top</span><span class=o>.</span><span class=n>SmallestPerKey</span><span
class=p>(</span><span class=mi>2</span><span class=p>)</span>
+      <span class=o>|</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Map</span><span class=p>(</span><span class=k>print</span><span
class=p>))</span></code></pre></div></div><p class=notebook-skip>Output:</p><div
class=notebook-skip><pre><code>(&#39;🥕&#39;, [2, 3])
+(&#39;🍆&#39;, [1])
+(&#39;🍅&#39;, [3, 4])</code></pre></div><table align=left
style=margin-right:1em class=.language-py><td><a class=button target=_blank href=https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/aggregation/top.py><img
src=https://www.tensorflow.org/images/GitHub-Mark-32px.png width=32px height=32px alt="View
source code"> View source code</a></td></table><p><br><br><br></p><h3
id=example-5-custom-elements-from-a-pcollection>Example 5: Custom eleme [...]
+By default you get the largest elements, but you can get the smallest by setting <code>reverse=True</code>.</p><div
class=language-py><div class=highlight><pre class=chroma><code class=language-py
data-lang=py><span class=kn>import</span> <span class=nn>apache_beam</span>
<span class=kn>as</span> <span class=nn>beam</span>
+
+<span class=k>with</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Pipeline</span><span class=p>()</span> <span class=k>as</span>
<span class=n>pipeline</span><span class=p>:</span>
+  <span class=n>shortest_elements</span> <span class=o>=</span> <span
class=p>(</span>
+      <span class=n>pipeline</span>
+      <span class=o>|</span> <span class=s1>&#39;Create produce names&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>Create</span><span class=p>([</span>
+          <span class=s1>&#39;🍓 Strawberry&#39;</span><span class=p>,</span>
+          <span class=s1>&#39;🥕 Carrot&#39;</span><span class=p>,</span>
+          <span class=s1>&#39;🍏 Green apple&#39;</span><span class=p>,</span>
+          <span class=s1>&#39;🍆 Eggplant&#39;</span><span class=p>,</span>
+          <span class=s1>&#39;🌽 Corn&#39;</span><span class=p>,</span>
+      <span class=p>])</span>
+      <span class=o>|</span> <span class=s1>&#39;Shortest names&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>combiners</span><span class=o>.</span><span
class=n>Top</span><span class=o>.</span><span class=n>Of</span><span
class=p>(</span>
+          <span class=mi>2</span><span class=p>,</span>         
   <span class=c1># number of elements</span>
+          <span class=n>key</span><span class=o>=</span><span
class=nb>len</span><span class=p>,</span>       <span class=c1>#
optional, defaults to the element itself</span>
+          <span class=n>reverse</span><span class=o>=</span><span
class=bp>True</span><span class=p>,</span>  <span class=c1># optional,
defaults to False (largest/descending)</span>
+      <span class=p>)</span>
+      <span class=o>|</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Map</span><span class=p>(</span><span class=k>print</span><span
class=p>)</span>
+  <span class=p>)</span></code></pre></div></div><p
class=notebook-skip>Output:</p><div class=notebook-skip><pre><code>[&#39;🌽
Corn&#39;, &#39;🥕 Carrot&#39;]</code></pre></div><table
align=left style=margin-right:1em class=.language-py><td><a class=button target=_blank
href=https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/aggregation/top.py><img
src=https://www.tensorflow.org/images/GitHub-Mark-32px.png width=32px height=32px alt="View
sourc [...]
+By default you get the largest elements, but you can get the smallest by setting <code>reverse=True</code>.</p><div
class=language-py><div class=highlight><pre class=chroma><code class=language-py
data-lang=py><span class=kn>import</span> <span class=nn>apache_beam</span>
<span class=kn>as</span> <span class=nn>beam</span>
+
+<span class=k>with</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Pipeline</span><span class=p>()</span> <span class=k>as</span>
<span class=n>pipeline</span><span class=p>:</span>
+  <span class=n>shortest_elements_per_key</span> <span class=o>=</span>
<span class=p>(</span>
+      <span class=n>pipeline</span>
+      <span class=o>|</span> <span class=s1>&#39;Create produce names&#39;</span>
<span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>Create</span><span class=p>([</span>
+          <span class=p>(</span><span class=s1>&#39;spring&#39;</span><span
class=p>,</span> <span class=s1>&#39;🥕 Carrot&#39;</span><span
class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;spring&#39;</span><span
class=p>,</span> <span class=s1>&#39;🍓 Strawberry&#39;</span><span
class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;summer&#39;</span><span
class=p>,</span> <span class=s1>&#39;🥕 Carrot&#39;</span><span
class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;summer&#39;</span><span
class=p>,</span> <span class=s1>&#39;🌽 Corn&#39;</span><span
class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;summer&#39;</span><span
class=p>,</span> <span class=s1>&#39;🍏 Green apple&#39;</span><span
class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;fall&#39;</span><span
class=p>,</span> <span class=s1>&#39;🥕 Carrot&#39;</span><span
class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;fall&#39;</span><span
class=p>,</span> <span class=s1>&#39;🍏 Green apple&#39;</span><span
class=p>),</span>
+          <span class=p>(</span><span class=s1>&#39;winter&#39;</span><span
class=p>,</span> <span class=s1>&#39;🍆 Eggplant&#39;</span><span
class=p>),</span>
+      <span class=p>])</span>
+      <span class=o>|</span> <span class=s1>&#39;Shortest names per
key&#39;</span> <span class=o>&gt;&gt;</span> <span class=n>beam</span><span
class=o>.</span><span class=n>combiners</span><span class=o>.</span><span
class=n>Top</span><span class=o>.</span><span class=n>PerKey</span><span
class=p>(</span>
+          <span class=mi>2</span><span class=p>,</span>         
   <span class=c1># number of elements</span>
+          <span class=n>key</span><span class=o>=</span><span
class=nb>len</span><span class=p>,</span>       <span class=c1>#
optional, defaults to the value itself</span>
+          <span class=n>reverse</span><span class=o>=</span><span
class=bp>True</span><span class=p>,</span>  <span class=c1># optional,
defaults to False (largest/descending)</span>
+      <span class=p>)</span>
+      <span class=o>|</span> <span class=n>beam</span><span class=o>.</span><span
class=n>Map</span><span class=p>(</span><span class=k>print</span><span
class=p>)</span>
+  <span class=p>)</span></code></pre></div></div><p
class=notebook-skip>Output:</p><div class=notebook-skip><pre><code>(&#39;spring&#39;,
[&#39;🥕 Carrot&#39;, &#39;🍓 Strawberry&#39;])
+(&#39;summer&#39;, [&#39;🌽 Corn&#39;, &#39;🥕 Carrot&#39;])
+(&#39;fall&#39;, [&#39;🥕 Carrot&#39;, &#39;🍏 Green apple&#39;])
+(&#39;winter&#39;, [&#39;🍆 Eggplant&#39;])</code></pre></div><table
align=left style=margin-right:1em class=.language-py><td><a class=button target=_blank
href=https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/aggregation/top.py><img
src=https://www.tensorflow.org/images/GitHub-Mark-32px.png width=32px height=32px alt="View
source code"> View source code</a></td></table><p><br><br><br></p><h2
id=related-transforms>Related transforms</h2><ul>< [...]
+Pydoc</a></td></table><p><br><br><br></p></div></div><footer
class=footer><div class=footer__contained><div class=footer__cols><div class=footer__cols__col><div
class=footer__cols__col__logo><img src=/images/beam_logo_circle.svg class=footer__logo
alt="Beam logo"></div><div class=footer__cols__col__logo><img src=/images/apache_logo_circle.svg
class=footer__logo alt="Apache logo"></div></div><div class="footer__cols__col
footer__cols__col--md"><div class=footer__cols__col__title>Start</di [...]
 <a href=http://www.apache.org>The Apache Software Foundation</a>
 | <a href=/privacy_policy>Privacy Policy</a>
 | <a href=/feed.xml>RSS Feed</a><br><br>Apache Beam, Apache, Beam,
the Beam logo, and the Apache feather logo are either registered trademarks or trademarks
of The Apache Software Foundation. All other products or name brands are trademarks of their
respective holders, including The Apache Software Foundation.</div></footer></body></html>
\ No newline at end of file
diff --git a/website/generated-content/sitemap.xml b/website/generated-content/sitemap.xml
index 2143d73..deee6a5 100644
--- a/website/generated-content/sitemap.xml
+++ b/website/generated-content/sitemap.xml
@@ -1 +1 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>/blog/beam-2.23.0/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/categories/blog/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/blog/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/categories/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/blog/b
[...]
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>/blog/beam-2.23.0/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/categories/blog/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/blog/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/categories/</loc><lastmod>2020-07-29T14:52:28-07:00</lastmod></url><url><loc>/blog/b
[...]
\ No newline at end of file


Mime
View raw message