GitHub user HyukjinKwon opened a pull request:

    [SPARK-17854][SQL] rand/randn allows null as input seed

    ## What changes were proposed in this pull request?
    This PR proposes `rand`/`randn` accept `null` as input. In this case, it 
treats the values as `0`.
    It seems MySQL also accepts this.
    mysql> select rand(0);
    | rand(0)             |
    | 0.15522042769493574 |
    1 row in set (0.00 sec)
    mysql> select rand(NULL);
    | rand(NULL)          |
    | 0.15522042769493574 |
    1 row in set (0.00 sec)
    and also Hive does according to 
    ## How was this patch tested?
    Unit tests in `DataFrameSuite.scala` and `RandomSuite.scala`.

You can merge this pull request into a Git repository by running:

    $ git pull SPARK-17854

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #15432
commit 62542fc953f825e8a22eafe98fc85770434e859a
Author: hyukjinkwon <>
Date:   2016-10-11T09:21:18Z

    rand/randn allows null as input seed


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to