avg testcase issues (was: Re: syntax error in testcase manifest)

On 19/02/2011 13:20, Birte Glimm wrote:

> I fixed that now.

Thanks for that, it works now. I'm happy to help debug the test
set, by the way, so no worries, I fully understand it's a work in
progress.

I do have some issues to report with two testcases, both dealing with
the AVG operator.

Before I go into that: I have assumed that when the definition of AVG
(http://www.w3.org/TR/sparql11-query/#setFunctions) uses the '/'
division operator, this means it applies XPath's op:numeric-divide (as
defined in section 16.3). It would actually be good to clarify this in
the spec, I think (one way to do this would be to explicitly use
op:numeric-divide in the definition, rather than just '/').

Anyway, here goes:

1. testcase aggregates/agg-avg-01 ("AVG")

This testcase currently assumes a particular precision in xsd:decimal
division, which is not mandated by the XPath definition. XPath defines
that in xsd:decimal operations, rounding is implementation dependent
(see http://www.w3.org/TR/xpath-functions/#op.numeric, near the end of
the section).

In the test, five numbers of type xsd:decimal are averaged (1.0, 2.0,
3.5, 2.2, 2.2). The average is computed by executing a op:numeric-divide
on the sum of the five decimals: 11.1/5. The result of this is, as the
testcase defines, 2.22. However, this result increases precision to 2
decimals (note that the precision of the input is 1 decimal).

While this is not wrong, it is not the *only* correct answer: an
implementation that would round or truncate to 1 decimal and return 2.2
as the answer would IMHO also perform the operation correctly.

To fix this, I would suggest that the testcase numbers are adapted so
that the result of the division when not rounded is of the same
precision as the input. Alternatively, change the test case to work on
floats or doubles, as division behavior is more precisely defined for
those datatypes.

2. testcase aggregates/agg-avg-02 ("AVG with GROUP BY")

This testcase contains a typing error: the result of the AVG computation
where ?s = ex:ints should be of type xsd:decimal, not xsd:integer (XPath
defines the result of a op:numeric-divide on two integer arguments as
always being of type xsd:decimal).


That's all for now. I will continue to run tests with the DAWG
testcases, if I run into any more issues I'll report them here if that's ok.

Cheers,

Jeen

Received on Thursday, 24 February 2011 23:00:11 UTC