[Spark-4060] [MLlib] exposing special rdd functions to the public

You can try nested Seq:

~~~
val sliding = rdd.sliding(3).collect().toSeq.map(_.toSeq)
val expected = data.flatMap(x => x).sliding(3).map(_.toSeq)
assert(sliding === expected)
~~~