[ 
https://issues.apache.org/jira/browse/FLINK-3881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15275349#comment-15275349
 ] 

ASF GitHub Bot commented on FLINK-3881:
---------------------------------------

GitHub user mans2singh opened a pull request:

    https://github.com/apache/flink/pull/1970

    [FLINK-3881] [docs] Java 8 Documetation Sample Correction

    Thanks for contributing to Apache Flink. Before you open your pull request, 
please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your 
pull request. For more information and/or questions please refer to the [How To 
Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful 
description of your changes.
    
    - [ ] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira 
title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the 
JIRA id)
    
    - [ ] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [ ] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis 
build has passed
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mans2singh/flink FLINK-3881

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/1970.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1970
    
----
commit 24636be11803ccc3efa85afcb3f48922b7f67ee8
Author: mans2singh <[email protected]>
Date:   2016-05-07T19:08:02Z

    [FLINK-3881] [docs] Java 8 Documetation Sample Correction

----


> Error in Java 8 Documentation Sample
> ------------------------------------
>
>                 Key: FLINK-3881
>                 URL: https://issues.apache.org/jira/browse/FLINK-3881
>             Project: Flink
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 1.0.3
>         Environment: All
>            Reporter: Mans Singh
>            Assignee: Mans Singh
>            Priority: Minor
>              Labels: docuentation, java8, sample
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The java8 documentation 
> (https://ci.apache.org/projects/flink/flink-docs-master/apis/java8.html) has 
> samples, one of them included below:
> {code:java}
> DataSet<String> input = env.fromElements(1, 2, 3);
> // collector type must be declared
> input.flatMap((Integer number, Collector<String> out) -> {
>     for(int i = 0; i < number; i++) {
>         out.collect("a");
>     }
> })
> // returns "a", "a", "aa", "a", "aa" , "aaa"
> .print();
> {code}
> I tried the sample and I think there are two issues with it (unless I have 
> missed anything):
> 1. The DataSet should be DataSet<Integer> and not DataSet<String>
> 2. There should probably be a StringBuffer that in the flatMap function that 
> is used to  append "a" in the for loop and output 
> (out.collect(buffer.toString()) it rather than just out.collect("a");.  
> Currently, this produces only "a" each time rather than   "a", "a", "aa", 
> "a", "aa" , "aaa" as shown the comments.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to