W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2003

SAG-FO-05: aggregate functions

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Tue, 10 Jun 2003 17:49:32 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DCEF8@daemsg02.software-ag.de>
To: public-qt-comments@w3.org

This point has been made elsewhere, but we wish to emphasize it, as it seems
to be a serious design flaw.

The polymorphic nature of the aggregation functions, such as min/max/avg,
has not been thought through carefully enough.

It is important that these functions should be capable of a streamed
implementation. This means that if the first 999 values in a sequence are
untyped atomic, the choice of comparison or addition operator should not
depend on the type of the 1000th item. (Note that "order by" in XQuery has
this right: untyped atomic values are treated as strings, irrespective of
the types of the other items in the sequence). 

These functions (in particular sum) also have a problem in how they handle
the empty sequence. Because an empty set of doubles is not dynamically
distinguishable from an empty set of durations, sum() applied to the latter
returns the double value 0.0e0, which is in conflict with static typing
expectations. The only solution to this problem seems to be to stop
overloading the sum() function to handle durations (as proposed in

Michael Kay
Software AG
Received on Tuesday, 10 June 2003 11:49:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:48 UTC