[SPARK-2871] [PySpark] Add missing API

Try to bring all Java/Scala API to PySpark.
glom() actually puts all the elements in a list, so it can get out of memory errors and such. Instead, use mapPartitions to count the values, similar to RDD.count().