Github user giwa commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2538#discussion_r18132354
  
    --- Diff: examples/src/main/python/streaming/network_wordcount.py ---
    @@ -0,0 +1,20 @@
    +import sys
    +
    +from pyspark import SparkContext
    +from pyspark.streaming import StreamingContext
    +
    +if __name__ == "__main__":
    +    if len(sys.argv) != 3:
    +        print >> sys.stderr, "Usage: wordcount <hostname> <port>"
    +        exit(-1)
    +    sc = SparkContext(appName="PythonStreamingNetworkWordCount")
    +    ssc = StreamingContext(sc, 1)
    +
    +    lines = ssc.socketTextStream(sys.argv[1], int(sys.argv[2]))
    +    counts = lines.flatMap(lambda line: line.split(" "))\
    +                  .map(lambda word: (word, 1))\
    +                  .reduceByKey(lambda a, b: a+b)
    +    counts.pyprint()
    --- End diff --
    
    counts.pyprint() should be counts.pprint()
    
    ```
        def pprint(self):
            """
            Print the first ten elements of each RDD generated in this DStream. 
This is an output
            operator, so this DStream will be registered as an output stream 
and there materialized.
            """
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to