Wrong output for aggregated query

Hello support,

When I run this query against a 10 billion dataset in an instance of Virtuoso compiled from latest development branch:

select ?d count(?d) {
?s sides:has_for_result ?d.
}
group by ?d
order by asc(?d)

I got this wrong output

d                                count
LONG VARCHAR      LONG VARCHAR
__________________________________
0                     9965331
0.1                  380429
0.2                  17323013
0.5                  25054759
1                    14883927

5 Rows. -- 6823 msec.

because the right output is:

+------+--------------+
| d      |    count     |
+------+--------------+
|    0   |  92070570|
|  0.1  |   380429   |
|  0.2  | 99187593 |
|  0.3  |    40206    |
|0.425|   689019   |
|  0.5  |169843469|
|    1   |336567259|
+-----+---------+

For your information, the total number of has_for_result triples is 698 778 545
Any idea why Virtuoso is counting wrong?

Thanks

Hi @asanchez75,

Is your data live, so it can be analyzed?

VARCHARs are not Numeric Datatypes, so CAST to a Numeric Datatype if you want Numeric Ordering.