Skip to content
Snippets Groups Projects
  • linbojin's avatar
    6f0988b1
    [MINOR][DOC] Correct code snippet results in quick start documentation · 6f0988b1
    linbojin authored
    ## What changes were proposed in this pull request?
    
    As README.md file is updated over time. Some code snippet outputs are not correct based on new README.md file. For example:
    ```
    scala> textFile.count()
    res0: Long = 126
    ```
    should be
    ```
    scala> textFile.count()
    res0: Long = 99
    ```
    This pr is to add comments to point out this problem so that new spark learners have a correct reference.
    Also, fixed a samll bug, inside current documentation, the outputs of linesWithSpark.count() without and with cache are different (one is 15 and the other is 19)
    ```
    scala> val linesWithSpark = textFile.filter(line => line.contains("Spark"))
    linesWithSpark: org.apache.spark.rdd.RDD[String] = MapPartitionsRDD[2] at filter at <console>:27
    
    scala> textFile.filter(line => line.contains("Spark")).count() // How many lines contain "Spark"?
    res3: Long = 15
    
    ...
    
    scala> linesWithSpark.cache()
    res7: linesWithSpark.type = MapPartitionsRDD[2] at filter at <console>:27
    
    scala> linesWithSpark.count()
    res8: Long = 19
    ```
    
    ## How was this patch tested?
    
    manual test:  run `$ SKIP_API=1 jekyll serve --watch`
    
    Author: linbojin <linbojin203@gmail.com>
    
    Closes #14645 from linbojin/quick-start-documentation.
    6f0988b1
    History
    [MINOR][DOC] Correct code snippet results in quick start documentation
    linbojin authored
    ## What changes were proposed in this pull request?
    
    As README.md file is updated over time. Some code snippet outputs are not correct based on new README.md file. For example:
    ```
    scala> textFile.count()
    res0: Long = 126
    ```
    should be
    ```
    scala> textFile.count()
    res0: Long = 99
    ```
    This pr is to add comments to point out this problem so that new spark learners have a correct reference.
    Also, fixed a samll bug, inside current documentation, the outputs of linesWithSpark.count() without and with cache are different (one is 15 and the other is 19)
    ```
    scala> val linesWithSpark = textFile.filter(line => line.contains("Spark"))
    linesWithSpark: org.apache.spark.rdd.RDD[String] = MapPartitionsRDD[2] at filter at <console>:27
    
    scala> textFile.filter(line => line.contains("Spark")).count() // How many lines contain "Spark"?
    res3: Long = 15
    
    ...
    
    scala> linesWithSpark.cache()
    res7: linesWithSpark.type = MapPartitionsRDD[2] at filter at <console>:27
    
    scala> linesWithSpark.count()
    res8: Long = 19
    ```
    
    ## How was this patch tested?
    
    manual test:  run `$ SKIP_API=1 jekyll serve --watch`
    
    Author: linbojin <linbojin203@gmail.com>
    
    Closes #14645 from linbojin/quick-start-documentation.