RE: DN-FO-09: 15.1.11 fn:distinct-values

Being able to have fn:distinct-values return the values
implementation-dependent provides for better performance for this often
performance critical operation. Thus I would be strongly against
mandating an order.

If you need to preserve order you have the following options:

- Write your own function that does so
- Lobby your favorite vendor to provide the functionality
- Lobby for the next version of XQuery/XPath to provide this
functionality.

In order to do any of the last two, you would need to provide some
compelling use cases.

Best regards
Michael

> -----Original Message-----
> From: public-qt-comments-request@w3.org [mailto:public-qt-comments-
> request@w3.org] On Behalf Of Dimitre Novatchev
> Sent: Monday, June 23, 2003 10:59 AM
> To: public-qt-comments@w3.org
> Subject: DN-FO-09: 15.1.11 fn:distinct-values
> 
> 
> DN-FO-09: 15.1.11 fn:distinct-values
> 
> There are two issues with this function:
> 
> 1. This function is of little use because "The order of the values
> returned
> is implementation dependent".
>    The programmer will not be able to find the answer to the following
two
> questions:
> 
> 	* Which values and in what order are exactly returned?
> 	* What should we do if we need to preserve order in the result?
> 
> 
> 2.    The example is wrong:
>             "fn:distinct-values(1, 2.0, 3, 2) returns (1, 3, 2.0)"
>       Actually:
>             fn:distinct-values(1, 2.0, 3, 2) might return (1, 3, 2.0)
> 
> 	because the order in which the values are returned is
implementation
> dependent.
> 
> Suggested solution:
> 	Change the semantics of the function to return each first in
> sequence order
> distinct value.
> 
> Dimitre Novatchev.
> 

Received on Monday, 23 June 2003 19:46:14 UTC