On Tue, Jan 7, 2014 at 12:39 PM, Michael Kay <[email protected]> wrote:
> > On 7 Jan 2014, at 12:30, Ihe Onwuka <[email protected]> wrote: > > I am most distressed that this worked, firstly > > section 3.10.8 of the spec says > > An order by clause contains one or more ordering specifications, called > orderspecs <http://www.w3.org/TR/xquery-30/#doc-xquery30-OrderSpec>, as > shown in the grammar. For each tuple in the input tuple stream, the > orderspecs are evaluated, using the variable bindings in that tuple. > > but for that query to have worked it must have applied the orderspec to > each tuple in the post-grouping tuple stream. > > > Yes, the output tuple stream of the group-by is the input tuple stream for > the order-by. > > But that is the entire source of the befuddlement. There is nothing I can see that says that the input tuple stream of the order by is sourced from the group by (unless there is some presumption consequent on the juxtaposition of the statements). So I read it as meaning that the input tuple stream to the order by must be the pre-grouping tuple stream. > > It also suggests that the count($thing) has to be evaluated twice (in the > order by and the return - perhaps this gets optimised) because of the > prohibition of the let - following the group by. > > > Yes, I was surprised to see that a "let" clause isn't allowed after an > order-by or group-by. I don't remember the reasons for that. > > Please don't ask me to defend the design. I wanted grouping to work on a > sequence of items (like windowing does), not on a stream of tuples, but I > was heavily outvoted. > > Michael Kay > Saxonica > > > _______________________________________________ > [email protected] > http://x-query.com/mailman/listinfo/talk >
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
