spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dylan Guedes (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-28086) Adds `random()` sql function
Date Tue, 16 Jul 2019 18:51:00 GMT

    [ https://issues.apache.org/jira/browse/SPARK-28086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16886382#comment-16886382
] 

Dylan Guedes commented on SPARK-28086:
--------------------------------------

Well, to be fair I've created the JIRA because the `rand()` looks like a number generator,
while `random()` (available at PgSQL) seems like a "pick any available value". For instance:
you may use `order by random()` in PgSQL, however, in Spark `order by rand()` is not valid.
But, I'm probably wrong: maybe it is related with PgSQL `order by` accepting literal values
while Spark not.

> Adds `random()` sql function
> ----------------------------
>
>                 Key: SPARK-28086
>                 URL: https://issues.apache.org/jira/browse/SPARK-28086
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Dylan Guedes
>            Priority: Major
>
> Currently, Spark does not have a `random()` function. Postgres, however, does.
> For instance, this one is not valid:
> {code:sql}
> SELECT rank() OVER (ORDER BY rank() OVER (ORDER BY random()))
> {code}
> Because of the `random()` call. On the other hand, [Postgres has it.|https://www.postgresql.org/docs/8.2/functions-math.html]



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message