apache/spark — pull request #462 by smartnut007 (2014-04-21 07:57:16+00:00)
Title: SPARK-1438 RDD make seed optional in RDD methods sam...

Its probably better to let the underlying language implementation take care of the default seed if none is specified by the user. This was easier to do with python as the default value for seed in random and numpy random is None.

In Scala/Java side it might meen propagating an Option or null(oh no!) down the chain until where the Random is constructed. But, looks like the convention in some other methods was to use System.nanoTime. So, followed that convention.

Conflict with overloaded method in sql.SchemaRDD
SchemaRDD defines an overloaded method
sample(fraction, withReplacement=false, seed=math.random)

So, SchemaRDD had tow sample methods with same parameters in different order. I believe the author intended to override the RDD.sample method and not overload it. So, changed it.

Also, scala does not allow more than overloaded method to have default params. So, this code had to be modified. Not sure if there is exiting application code that might break because of this. If we need to keep things backward compatible, 3 new method can be introduced (without default params) like this
sample(fraction)
sample(fraction, withReplacement)
sample(fraction, withReplacement, seed)

Added some tests for the scala RDD takeSample method. Was able to test the java side manually.