[
https://issues.apache.org/jira/browse/PHOENIX-1516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14245842#comment-14245842
]
Julian Hyde commented on PHOENIX-1516:
--------------------------------------
RAND without arguments seems to produce a new value per invocation, whereas
RAND with arguments produces one value per row. Furthermore the latter results
are repeatable if you re-run the same statement.
{code}
mysql> select rand(), rand(), rand(1), rand(1) from t1;
+---------------------+--------------------+---------------------+---------------------+
| rand() | rand() | rand(1) | rand(1)
|
+---------------------+--------------------+---------------------+---------------------+
| 0.45809529112474556 | 0.7796456048075534 | 0.40540353712197724 |
0.40540353712197724 |
| 0.5239421813971756 | 0.2807741232968626 | 0.8716141803857071 |
0.8716141803857071 |
+---------------------+--------------------+---------------------+---------------------+
2 rows in set (0.00 sec)
mysql> select rand(), rand(), rand(1), rand(1) from t1;
+--------------------+---------------------+---------------------+---------------------+
| rand() | rand() | rand(1) | rand(1)
|
+--------------------+---------------------+---------------------+---------------------+
| 0.8320441030264312 | 0.31789817597521297 | 0.40540353712197724 |
0.40540353712197724 |
| 0.0933586015304165 | 0.5130985104600885 | 0.8716141803857071 |
0.8716141803857071 |
+--------------------+---------------------+---------------------+---------------------+
2 rows in set (0.00 sec)
{code}
This seems to be a good semantic to implement in Phoenix (and Calcite for that
matter).
> Add RANDOM built-in function
> ----------------------------
>
> Key: PHOENIX-1516
> URL: https://issues.apache.org/jira/browse/PHOENIX-1516
> Project: Phoenix
> Issue Type: Bug
> Reporter: Lars Hofhansl
> Assignee: Lars Hofhansl
> Attachments: 1516.txt
>
>
> I often find it useful to generate some rows with random data.
> Here's a simple RANDOM() function that we could use for that.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)