RumbleDB/rumble

Exception when grouping with keys of different types

elwin opened this issue · 1 comments

elwin commented

The following query will throw an exception that should not be thrown:

for $x in ("1", 49) group by $x return $x

(:  "eq": operation not possible with parameters of type "xs:integer" and "xs:string" :)

The reason for that is the following:
hashCode() will map "1" to 49 (its ASCII representation) and will thus land in the same bucket as 49 (whose hashCode() is simply 49 as well). So far, this is fine.

However, subsequently they will be compared using compareWithFlworKey() which throws an exception due to type mismatch.
Expected result is (1, 49) or (49, 1) (depending on ordering).

elwin commented

I'm currently trying to come up with a fix which is tracked on Gitlab here on Github here.