W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2010

Re: Proposed RAND() defn

From: Steve Harris <steve.harris@garlik.com>
Date: Thu, 2 Dec 2010 13:53:48 +0000
Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
Message-Id: <8CF2B6B4-863F-4BB1-9620-ED36DCA84FE9@garlik.com>
To: Andy Seaborne <andy.seaborne@epimorphics.com>
On 2010-12-02, at 12:12, Andy Seaborne wrote:

>> Maybe I don't understand RAND for SQL well enough but I thought that
>> RAND() returns different numbers in
>> 
>> FILTER(RAND()> 0.5&& RAND()< 0.6)
>> 
>> (if you want the same number assign it in some way)
>> 
>> As RAND() returns different numbers, so
> 
> MySQL:
> 
> select rand() as A , rand() as B from T ;
> 
> +-------------------+-------------------+
> | A                 | B                 |
> +-------------------+-------------------+
> | 0.231994651474054 | 0.353741641485823 |
> +-------------------+-------------------+
> 1 row in set (0.00 sec)

Yes, my draft def'n of RAND() specifies that behaviour, but:

select rand(1) as A , rand(1) as B from foo;
+------------------+------------------+
| A                | B                |
+------------------+------------------+
| 0.40540353712198 | 0.40540353712198 | 
| 0.87161418038571 | 0.87161418038571 | 
+------------------+------------------+
2 rows in set (0.00 sec)

That's important behaviour for usability, due to the bottom up execution of SQL (and SPARQL).

- Steve

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD
Received on Thursday, 2 December 2010 13:54:27 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:44 GMT