You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new tolog NumbersModule [1] adds support for numbers. Tolog does not sort
numbers correctly, though. This can be reproduced by using this query:
import "http://psi.ontopia.net/tolog/numbers/" as numbers
select $value from
{ numbers:value("6", $value)
| numbers:value("45", $value)
| numbers:value("78", $value)
| numbers:value("123", $value)
} order by $value?
Tolog returns 123, 45, 6, 78 instead of 6, 45, 78, 123.
This is caused by the RowComparator inner class in QueryProcessor. The code
applies ORDER_OBJECT sorting for multi-typed signature arguments, which means
ObjectUtils.toString(value) for non TMObjectIF objects. The NumbersModule uses
'n' as signature, which returns two types [2]: Integer and Float. This results
in numbers being sorted by their String equivalent, which explains the
erroneous behaviour.
To fix this issue, check if multi-typed signatures hold only Numbers subclasses
and, if so, apply a separate sorting algorithm on these numbers.
[1]: http://code.google.com/p/ontopia/source/detail?r=2182
[2]:
http://code.google.com/p/ontopia/source/browse/trunk/ontopia-engine/src/main/jav
a/net/ontopia/topicmaps/impl/utils/ArgumentValidator.java?r=2126#100
Original issue reported on code.google.com by p.kruijsen on 19 Sep 2011 at 10:59
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
p.kruijsen
on 19 Sep 2011 at 10:59The text was updated successfully, but these errors were encountered: