- From: Bas de Bakker <bas@x-hive.com>
- Date: Mon, 18 Nov 2002 05:42:35 -0500 (EST)
- To: <public-qt-comments@w3.org>
Dear XQuery WG, In the new working draft you invite feedback on the new "order by" clause. Reading the issue list, it seems to have been created because of incorrect assumptions. In issue 155, I read: Instead, the query would have to be written as FOR $e IN (FOR $x IN //employee RETURN $x SORTBY employee/salary/data()) WHERE ... RETURN <newe>$e/name</newe> This is not true, leaving in some of the old syntax it could have been written as FOR $e IN (//employee SORTBY (employee/salary/data())) WHERE ... RETURN <newe>$e/name</newe> This is easily optimized to perform the "where" filter before the sort. In issue 251 I read: What you have to write is for $z in for $x in book, $y in review where $x/isbn = $y/isbn return <dummy>{ $x/title, $x/author, $y/reviewer, $x/isbn }</dummy> sortby isbn return <newbook>{ $z/title, $z/author, $z/reviewer }</newbook> Again, this is not true. This is much more easily written as: for $x in book sort by (isbn), $y in review where $x/isbn = $y/isbn return <newbook>{ $x/title, $x/author, $y/reviewer }</newbook> The only thing that the new order by clause permits is sorting tuples on some combination of their values, as in for $salary in ..., $bonus in ... order by ($salary + $bonus) return ... This example is ridiculous, as you normally want to have for $employee in (... sort by (salary + bonus)) but I cannot think of a realistic use case. To summarize: I fail to see what common problem "order by" is supposed to solve. If you want to solve a problem our users actually do have, please spend your (limited) time on creating "group by" instead. Regards, Bas de Bakker X-Hive Corporation
Received on Monday, 18 November 2002 08:34:41 UTC