[SPARK-2534] Avoid pulling in the entire RDD in various operators (branch-1.0 backport)

This backports #1450 into branch-1.0.