Re: SAMPLE aggregate function

good afternoon;

On 8 Jul 2014, at 13:08, Steve Harris <steve@totl.net> wrote:

> Yes, but in that case, the results are per-group, so it’s somewhat obvious.

as obvious as it may be, not on the basis of any “lexical connection” more obvious than in the case of an aggregation without grouping.

> 
> You wouldn’t expect (RAND() as ?A) (RAND() as ?B) to consistently return the same number twice, I suspect? 

this reader did not expect the sample behavior described initially, either.
not because of the presence or absence of any lexical connection which a construct such as "SAMPLE(?a, ?b)” might indicate, but because the operator is defined to be non-deterministic.

> 
> On 8 Jul 2014, at 11:17, james anderson <james@dydra.com> wrote:
> 
>> good afternoon,
>> 
>> On 8 Jul 2014, at 11:56, Steve Harris <steve@totl.net> wrote:
>> 
>>> I suspect that’s less surprising than the alternative. There’s no lexical connection between the SAMPLE() expressions so I don’t see why a user would expect them to return values from the same solution.
>> 
>> the expectation is not without analog, in that, if the aggregation involves groups, the bindings in each solution must derive from the same group.
>> 
>>> 
>>> If it was SAMPLE(?a, ?b) AS (?a, ?b) I would agree.
>>> 
>>> On 7 Jul 2014, at 23:27, Jeremy J Carroll <jjc@syapse.com> wrote:
>>> 
>>>> 
>>>> 
>>>> I was thinking about SAMPLE and feel that there is a bug with the spec because it allows
>>>> 
>>>> 
>>>> A=1 B=2
>>>> 
>>>> as an answer from
>>>> 
>>>> SELECT (SAMPLE(?a) as ?A) (SAMPLE(?b) as ?B)
>>>> {
>>>> { BIND(1 as ?a) BIND(1 as ?b)}
>>>> UNION
>>>> { BIND(2 as ?a) BIND(2 as ?b)}
>>>> }
>>>> 
>>>> 
>>>> I think the principal of least surprise would suggest that a single select should use the same solution to pick out the sample values, giving either 1,1 or 2,2 as possible solutions here.
>>>> 
>>>> Jeremy
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>> 
>> ---
>> james anderson | james@dydra.com | http://dydra.com
>> 
>> 
>> 
>> 
>> 
> 

---
james anderson | james@dydra.com | http://dydra.com

Received on Tuesday, 8 July 2014 12:25:36 UTC