title: The function passed to map never gets called
body: <p>I'm trying to make a function call through the <code>map</code> function available in spark.
  I did what was given in the spark tutorial page (<a href="https://spark.apache.org/docs/1.2.0/programming-guide.html" rel="nofollow">https://spark.apache.org/docs/1.2.0/programming-guide.html</a>). But the function <code>myFunc</code> never gets called. At least that's what I think. I don't know if I'm doing something wrong or missing out something.
  This is the following code:</p>
  
  <pre><code>from pyspark import SparkContext
  if __name__ == "__main__":
      def myFunc(s):
          print("@@")
          words = s.split("\n")
          print("##")
          return len(words)
  
  
      sc = SparkContext("local","test")
      sc.textFile("C:\\TestLogs\\sample.log").map(myFunc)
      print("**")
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>**
  </code></pre>
  
  <p>In fact, this is the same example from the spark doc except for the file location.</p>