[ 
https://issues.apache.org/jira/browse/BEAM-7389?focusedWorklogId=291430&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-291430
 ]

ASF GitHub Bot logged work on BEAM-7389:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Aug/19 17:23
            Start Date: 08/Aug/19 17:23
    Worklog Time Spent: 10m 
      Work Description: rosetn commented on pull request #9260: [BEAM-7389] Add 
code examples for FlatMap page
URL: https://github.com/apache/beam/pull/9260#discussion_r312149438
 
 

 ##########
 File path: website/src/documentation/transforms/python/element-wise/flatmap.md
 ##########
 @@ -19,24 +19,287 @@ limitations under the License.
 -->
 
 # FlatMap
-<table align="left">
-    <a target="_blank" class="button"
+
+<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.core.html#apache_beam.transforms.core.FlatMap";>
-      <img src="https://beam.apache.org/images/logos/sdks/python.png"; 
width="20px" height="20px"
-           alt="Pydoc" />
-     Pydoc
+      <img src="https://beam.apache.org/images/logos/sdks/python.png";
+          width="20px" height="20px" alt="Pydoc" />
+      Pydoc
     </a>
+  </td>
 </table>
 <br>
+
 Applies a simple 1-to-many mapping function over each element in the 
collection.
 The many elements are flattened into the resulting collection.
 
 ## Examples
-See [BEAM-7389](https://issues.apache.org/jira/browse/BEAM-7389) for updates. 
 
-## Related transforms 
+In the following examples, we create a pipeline with a `PCollection` of 
produce their icon, name, and duration.
+Then, we apply `FlatMap` in multiple ways to yield zero or more elements per 
each input element into the resulting `PCollection`.
+
+`FlatMap` accepts a function that returns an `iterable`,
+where each of the output `iterable`'s elements will be an element of the 
resulting `PCollection`.
+
+### Example 1: FlatMap with a predefined function
+
+We use the function `str.split` which takes a single `str` element and outputs 
a `list` of `str`s.
+It will split the input element using whitespaces, creating a list of zero or 
more elements.
 
 Review comment:
   "It will split"->"This pipeline splits"
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 291430)
    Time Spent: 37h 10m  (was: 37h)

> Colab examples for element-wise transforms (Python)
> ---------------------------------------------------
>
>                 Key: BEAM-7389
>                 URL: https://issues.apache.org/jira/browse/BEAM-7389
>             Project: Beam
>          Issue Type: Improvement
>          Components: website
>            Reporter: Rose Nguyen
>            Assignee: David Cavazos
>            Priority: Minor
>          Time Spent: 37h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to