- From: <bugzilla@jessica.w3.org>
- Date: Tue, 05 Oct 2010 22:40:47 +0000
- To: public-qt-comments@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10980 Summary: [XQuery11] incorrect group by example Product: XPath / XQuery / XSLT Version: Member-only Editors Drafts Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: XQuery 1.1 AssignedTo: jonathan.robie@redhat.com ReportedBy: andrew.eisenberg@us.ibm.com QAContact: public-qt-comments@w3.org Group: XSLXQuery_WG The final example in section 3.9.7, Group By Clause, is: o When writing a query that includes a group by clause, it is important to remember that, in each post-grouping tuple, each grouping variable is bound to a single atomic value (a grouping key), and all other variables are bound to sequences of items derived from all the pre-grouping tuples from which the group was formed. The following example illustrates how to avoid a possible pitfall in writing grouping queries. let $high-price := 1000 for $p in $products[price > $high-price] let $category := $p/category group by $category return <category name="{$category}"> {fn:count($p)} products have price greater than {$high-price}. </category> The statement is incorrect. The grouping keys are atomized values, but not the grouping variables. We say, "In the post-grouping tuple, each grouping variable is bound to the value of that variable in one of the pre-grouping tuples from which the group is derived." Just before an editorial note on this topic. The first sentence of the example should be removed. If we wish to show that the grouping variables are not atomized, then we might add an example such as: let $high-price := 1000 return for $p in $products[price > $high-price] let $category := $p/category group by $category return <result> { $category, <comment> {fn:count($p)} products have price greater than {$high-price}. </comment> } </result> The result of this query might contain the following element: <result> <category name="Men's Wear"/> <comment>3 products have price greater than 1000.</comment> </result> -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug.
Received on Tuesday, 5 October 2010 22:40:49 UTC