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: Sun, 12 Dec 2010 23:35:58 +0000
Message-Id: <0DDCE4BA-5F67-41E8-8DBF-B45A779821D8@garlik.com>
To: SPARQL Working Group <public-rdf-dawg@w3.org>, Andy Seaborne <andy.seaborne@epimorphics.com>
FYI, after some more discussion with Andy, and some experiments, my preference is now to not specify any seeding mechanism.

There are at least half a dozen different ways it works in different SQL systems, and they all have peculiar quirks, especially when you try to define them with SPARQL terminology.

When people have had a chance to use RAND() in production systems for a year or more it will hopefully be more obvious how you'd want a seeding function to behave in SPARQL.

- Steve

On 2010-12-02, at 13:53, Steve Harris wrote:

> 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
> 
> 

-- 
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 Sunday, 12 December 2010 23:36:34 GMT

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