
Thanks for all your help and suggestions! I will file a bug report and use the workaround proposed by Stefan for now. @Sjoerd: thanks for the info, that means I cannot just hard code a value to divide the RAND output by to normalize. Does anyone know of a way to get the maximum returned value by a call to RAND() in SQL? On 21-10-15 09:13, Sjoerd Mullender wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
The range of RAND is system dependent. On Linux (glibc) it's 0 - 2^63-1, but on Windows it's only 0 - 2^31-1. I don't know for other platforms.
On 20/10/15 23:41, Stefan Manegold wrote:
(In MonetDB,) BIGINT is a 64-bit signed integer, independent of the hardware/OS platform; hence, the largest value is 2^63-1 (the smallest value in MonetDB is -(2^63-1)); see also https://www.monetdb.org/wiki/MonetDB_type_system
Stefan
----- On Oct 20, 2015, at 5:55 PM, Sjoerd Mullender sjoerd@acm.org wrote:
On 20/10/15 16:51, Robin Cijvat wrote:
Hello everyone! I am facing some (probably simple) problems. A snippet of a timestamp column in my table:
+----------------------------+ | ts | +============================+ | 1595-04-02 00:00:00.000000 | | 1595-04-02 00:00:00.000000 | | 1595-04-02 00:00:00.000000 | | 1595-04-02 00:00:00.000000 | | 1598-03-25 00:00:00.000000 | +----------------------------+
I want to fill all the times in these fields with a random value (uniformly distributed is fine). This faces me with the following problems:
1) Adding an interval to a timestamp does not seem to be suited for dynamic intervals: This works fine: UPDATE "table" SET ts = (ts + INTERVAL '5000' SECOND); This doesn't: UPDATE "table" SET ts = (ts + INTERVAL (CAST(5000 AS STRING)) SECOND); Does someone maybe know of a way to accomplish this?
2) Does someone know how to normalize the output of the RAND operator available in SQL? It seems to calculate a random BIGINT, and in order for me to normalize it, I would need the maximum value of a BIGINT, which of course is platform dependent. Is there a way to get the max value of BIGINT on the SQL level? Or can I go about this another way?
All help is much appreciated!
Robin sql>select cast(5000 as interval second); +----------+ | L1 | +==========+ | 5000.000 | +----------+
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
Sjoerd Mullender -----BEGIN PGP SIGNATURE----- Version: GnuPG v2
iQEcBAEBCAAGBQJWJzr8AAoJEISMxT6LrWYghCwIAL7QiRsOmorYkxXDSnT686iJ zn9Wco//qf0xWaGKHMimhXP0LWX9SN1rJSOckZXaFYC+mTdumhzBgRwSop46cNYZ u+xoRzoqYoKpTcEjZekJ97pjMADUU3np6sUbx0lwbr1ELHYJ08KmLJk7gxF9YRxp UGjsMt7kJQ5rnvfFlodOPuNZEj1uG5KDR92eQTP59wt5d9NweiKaPvntSuJWp78W aiOlkdgHtqEjn1qMvwTwQvxGkKQrW/q+Q9W9prc9WVIUc6WOaM/KOuS1JKkWe1Kp wqVbbsTOYekyH4xxOmLjpyJnO7p+qNZYyX4xs7+fHSRTnUjFBN+A3qQWIaSAYrA= =Lspw -----END PGP SIGNATURE----- _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list