[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qexo-general] problems aggregating with sum()
From: |
Kevin Y. Kim (Lists) |
Subject: |
Re: [Qexo-general] problems aggregating with sum() |
Date: |
Thu, 27 Oct 2005 12:56:14 -0400 |
On Oct 27, 2005, at 1:30 AM, Per Bothner wrote:
...
That is not a well-formed XML file. At least, it is not a legal
"XML document", which can have only a single top-level element.
...
Likewise not valid XML. It could be valid in the XQuery data model,
if you view it as a sequence of elements.
Yeah, sorry about that - I was just trying to understand Qexo, and
didn't think about the "well-formedness" of my file(s).
Just on a lark, I changed the SUM() to COUNT() - and it does
report the correct number of items in the sequence.
The problem is that $recs/value/text() evaluates to a sequence of
text nodes, and Qexo doesn't know how to convert each text node
to a number - only to a string. This has to do with complicated
XQuery typing rules - which Qexo doesn't implement correctly yet.
Interesting. I also tried AVG() and that seem to work. I would
assume that AVG() and SUM() would have to do the same conversion
at some point. Of course, I know nothing about the internals :-).
As a work-around try:
sum(for $none in $recs/value/text() return number($node))
I assume that should read:
sum(for $node in $recs/value/text() return number($node))
^^^^^- was "$none"
Just wanted to clarify.
Thanks,
-kevin