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, 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. > > 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
