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 623bee5 Publishing website 2019/08/13 01:51:49 at commit 1e8f8b0 623bee5 is described below commit 623bee5a139824ec3c608a7116acc001ec209124 Author: jenkins <bui...@apache.org> AuthorDate: Tue Aug 13 01:51:50 2019 +0000 Publishing website 2019/08/13 01:51:49 at commit 1e8f8b0 --- .../python/elementwise/filter/index.html | 68 +++++++++++++++++- .../python/elementwise/values/index.html | 80 +++++++++++++++++++--- 2 files changed, 136 insertions(+), 12 deletions(-) diff --git a/website/generated-content/documentation/transforms/python/elementwise/filter/index.html b/website/generated-content/documentation/transforms/python/elementwise/filter/index.html index 8c58ae6..7721f27 100644 --- a/website/generated-content/documentation/transforms/python/elementwise/filter/index.html +++ b/website/generated-content/documentation/transforms/python/elementwise/filter/index.html @@ -490,13 +490,14 @@ on the comparison ordering of the element.</p> <h2 id="examples">Examples</h2> -<p>In the following examples, we create a pipeline with a <code class="highlighter-rouge">PCollection</code> of produce their icon, name, and duration. +<p>In the following examples, we create a pipeline with a <code class="highlighter-rouge">PCollection</code> of produce with their icon, name, and duration. Then, we apply <code class="highlighter-rouge">Filter</code> in multiple ways to filter out produce by their duration value.</p> +<p><code class="highlighter-rouge">Filter</code> accepts a function that keeps elements that return <code class="highlighter-rouge">True</code>, and filters out the remaining elements.</p> + <h3 id="example-1-filtering-with-a-function">Example 1: Filtering with a function</h3> -<p>We define a function <code class="highlighter-rouge">is_perennial</code> which returns <code class="highlighter-rouge">True</code> if the elementβs duration equals <code class="highlighter-rouge">'perennial'</code>, and <code class="highlighter-rouge">False</code> otherwise. -<code class="highlighter-rouge">Filter</code> accepts this function, keeps elements that return <code class="highlighter-rouge">True</code>, and filters out the remaining elements.</p> +<p>We define a function <code class="highlighter-rouge">is_perennial</code> which returns <code class="highlighter-rouge">True</code> if the elementβs duration equals <code class="highlighter-rouge">'perennial'</code>, and <code class="highlighter-rouge">False</code> otherwise.</p> <div class="language-py highlighter-rouge"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">apache_beam</span> <span class="kn">as</span> <span class="nn">beam</span> @@ -519,6 +520,16 @@ Then, we apply <code class="highlighter-rouge">Filter</code> in multiple ways to </code></pre> </div> +<p>Output <code class="highlighter-rouge">PCollection</code> after <code class="highlighter-rouge">Filter</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code>perennials = [ + {'icon': 'π', 'name': 'Strawberry', 'duration': 'perennial'}, + {'icon': 'π', 'name': 'Eggplant', 'duration': 'perennial'}, + {'icon': 'π₯', 'name': 'Potato', 'duration': 'perennial'}, +] +</code></pre> +</div> + <table> <td> <a class="button" target="_blank" href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py"> @@ -552,6 +563,16 @@ Then, we apply <code class="highlighter-rouge">Filter</code> in multiple ways to </code></pre> </div> +<p>Output <code class="highlighter-rouge">PCollection</code> after <code class="highlighter-rouge">Filter</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code>perennials = [ + {'icon': 'π', 'name': 'Strawberry', 'duration': 'perennial'}, + {'icon': 'π', 'name': 'Eggplant', 'duration': 'perennial'}, + {'icon': 'π₯', 'name': 'Potato', 'duration': 'perennial'}, +] +</code></pre> +</div> + <table> <td> <a class="button" target="_blank" href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py"> @@ -590,6 +611,16 @@ They are passed as additional positional arguments or keyword arguments to the f </code></pre> </div> +<p>Output <code class="highlighter-rouge">PCollection</code> after <code class="highlighter-rouge">Filter</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code>perennials = [ + {'icon': 'π', 'name': 'Strawberry', 'duration': 'perennial'}, + {'icon': 'π', 'name': 'Eggplant', 'duration': 'perennial'}, + {'icon': 'π₯', 'name': 'Potato', 'duration': 'perennial'}, +] +</code></pre> +</div> + <table> <td> <a class="button" target="_blank" href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py"> @@ -631,6 +662,16 @@ We then use that value to filter out perennials.</p> </code></pre> </div> +<p>Output <code class="highlighter-rouge">PCollection</code> after <code class="highlighter-rouge">Filter</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code>perennials = [ + {'icon': 'π', 'name': 'Strawberry', 'duration': 'perennial'}, + {'icon': 'π', 'name': 'Eggplant', 'duration': 'perennial'}, + {'icon': 'π₯', 'name': 'Potato', 'duration': 'perennial'}, +] +</code></pre> +</div> + <table> <td> <a class="button" target="_blank" href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py"> @@ -674,6 +715,17 @@ so it is possible to iterate over large <code class="highlighter-rouge">PCollect </code></pre> </div> +<p>Output <code class="highlighter-rouge">PCollection</code> after <code class="highlighter-rouge">Filter</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code>valid_plants = [ + {'icon': 'π', 'name': 'Strawberry', 'duration': 'perennial'}, + {'icon': 'π₯', 'name': 'Carrot', 'duration': 'biennial'}, + {'icon': 'π', 'name': 'Eggplant', 'duration': 'perennial'}, + {'icon': 'π ', 'name': 'Tomato', 'duration': 'annual'}, +] +</code></pre> +</div> + <table> <td> <a class="button" target="_blank" href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py"> @@ -723,6 +775,16 @@ If the <code class="highlighter-rouge">PCollection</code> wonβt fit into memor </code></pre> </div> +<p>Output <code class="highlighter-rouge">PCollection</code> after <code class="highlighter-rouge">Filter</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code>perennials = [ + {'icon': 'π', 'name': 'Strawberry', 'duration': 'perennial'}, + {'icon': 'π', 'name': 'Eggplant', 'duration': 'perennial'}, + {'icon': 'π₯', 'name': 'Potato', 'duration': 'perennial'}, +] +</code></pre> +</div> + <table> <td> <a class="button" target="_blank" href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py"> diff --git a/website/generated-content/documentation/transforms/python/elementwise/values/index.html b/website/generated-content/documentation/transforms/python/elementwise/values/index.html index fb1c7d9..d2ad968 100644 --- a/website/generated-content/documentation/transforms/python/elementwise/values/index.html +++ b/website/generated-content/documentation/transforms/python/elementwise/values/index.html @@ -437,7 +437,7 @@ <ul class="nav"> - <li><a href="#examples">Examples</a></li> + <li><a href="#example">Example</a></li> <li><a href="#related-transforms">Related transforms</a></li> </ul> @@ -460,23 +460,85 @@ limitations under the License. --> <h1 id="values">Values</h1> -<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.Values"> + +<script type="text/javascript"> +localStorage.setItem('language', 'language-py') +</script> + +<table> + <td> + <a class="button" target="_blank" href="https://beam.apache.org/releases/pydoc/current/apache_beam.transforms.util.html#apache_beam.transforms.util.Values"> <img src="https://beam.apache.org/images/logos/sdks/python.png" width="20px" height="20px" alt="Pydoc" /> - Pydoc + Pydoc </a> + </td> </table> -<p><br /> -Takes a collection of key-value pairs, and returns the value of each element.</p> - -<h2 id="examples">Examples</h2> -<p>See <a href="https://issues.apache.org/jira/browse/BEAM-7389">BEAM-7389</a> for updates.</p> +<p><br /></p> + +<p>Takes a collection of key-value pairs, and returns the value of each element.</p> + +<h2 id="example">Example</h2> + +<p>In the following example, we create a pipeline with a <code class="highlighter-rouge">PCollection</code> of key-value pairs. +Then, we apply <code class="highlighter-rouge">Values</code> to extract the values and discard the keys.</p> + +<div class="language-py highlighter-rouge"><pre class="highlight"><code><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">plants</span> <span class="o">=</span> <span class="p">(</span> + <span class="n">pipeline</span> + <span class="o">|</span> <span class="s">'Garden plants'</span> <span class="o">>></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="s">'π'</span><span class="p">,</span> <span class="s">'Strawberry'</span><span class="p">),</span> + <span class="p">(</span><span class="s">'π₯'</span><span class="p">,</span> <span class="s">'Carrot'</span><span class="p">),</span> + <span class="p">(</span><span class="s">'π'</span><span class="p">,</span> <span class="s">'Eggplant'</span><span class="p">),</span> + <span class="p">(</span><span class="s">'π '</span><span class="p">,</span> <span class="s">'Tomato'</span><span class="p">),</span> + <span class="p">(</span><span class="s">'π₯'</span><span class="p">,</span> <span class="s">'Potato'</span><span class="p">),</span> + <span class="p">])</span> + <span class="o">|</span> <span class="s">'Values'</span> <span class="o">>></span> <span class="n">beam</span><span class="o">.</span><span class="n">Values</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> + +<p>Output <code class="highlighter-rouge">PCollection</code> after <code class="highlighter-rouge">Values</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code>plants = [ + 'Strawberry', + 'Carrot', + 'Eggplant', + 'Tomato', + 'Potato', +] +</code></pre> +</div> + +<table> + <td> + <a class="button" target="_blank" href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/values.py"> + <img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" width="20px" height="20px" alt="View on GitHub" /> + View on GitHub + </a> + </td> +</table> +<p><br /></p> <h2 id="related-transforms">Related transforms</h2> + <ul> <li><a href="/documentation/transforms/python/elementwise/keys">Keys</a> for extracting the key of each component.</li> + <li><a href="/documentation/transforms/python/elementwise/kvswap">KvSwap</a> swaps the key and value of each element.</li> </ul> +<table> + <td> + <a class="button" target="_blank" href="https://beam.apache.org/releases/pydoc/current/apache_beam.transforms.util.html#apache_beam.transforms.util.Values"> + <img src="https://beam.apache.org/images/logos/sdks/python.png" width="20px" height="20px" alt="Pydoc" /> + Pydoc + </a> + </td> +</table> +<p><br /></p> + </div> </div> <!--