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
{{ message }}
Repository navigation
A DECIMAL property does not equal a numerically-equal literal of a different scale: = 5.0 misses a stored 5 #7613
Split out of #7609 / PR #7612, where it was found but deliberately left out of scope.
The defect
Type.castComparableNumber() brings a BigDecimal and any other number to a common type, and QueryOperatorEquals then decides equality with couple[0].equals(couple[1]). BigDecimal.equals() is scale-sensitive: new BigDecimal("5").equals(new BigDecimal("5.0")) is false, even though compareTo answers 0.
So a DECIMAL property holding 5 does not equal the literal 5.0, and one holding 0.050 does not equal 0.05. The ordering operators (<, <=, >, >=) route through compareTo and are therefore correct on exactly the same pair of values, so >= and <= together answer rows that = does not.
Reproduction
Sweeping all 49 ordered pairs of the seven numeric types through castComparableNumber and checking compareTo(...) == 0 against .equals(...), four pairs disagree - every one of them a pair that ends as two BigDecimals of different scale:
Float vs BigDecimal -> compareTo 0, equals false
Double vs BigDecimal -> compareTo 0, equals false
BigDecimal vs Float -> compareTo 0, equals false
BigDecimal vs Double -> compareTo 0, equals false
castComparableNumber(5.0f, new BigDecimal("5")) returns BigDecimal("5.0") and BigDecimal("5").
#7609 is about a literal being read at the wrong precision. This is a different mechanism - the value is right and the equality test is wrong - and it predates that fix: BigDecimal.valueOf(5.0f) produced a scale-1 decimal before too. Fixing it means changing what = answers for DECIMAL properties, which deserves its own change and its own regression test rather than riding along.
Suggested fix
Type.normalizeNumberForKey() already solves this exact hazard for GROUP BY / DISTINCT keys, and its Javadoc spells out the reasoning (BigDecimal("1").equals(BigDecimal("1.0")) is false, so one logical group would split into several). The equality path wants the same treatment: either align the scales inside castComparableNumber when both sides land on BigDecimal, or have QueryOperatorEquals use compareTo(...) == 0 rather than .equals() for a BigDecimal couple.
The second is the narrower change and makes = agree with <=/>= by construction, but the first fixes every caller of castComparableNumber at once - BinaryComparator.equals() reaches the same .equals() on the returned couple. Worth deciding which contract the method is meant to offer.
Fixed: a DECIMAL property could fail to match a numerically-equal literal of a different scale (e.g. a stored 5 did not equal 5.0 in an equality check, even though >=/<= worked correctly). Decimal values are now aligned to the same scale before comparing, so equality now agrees with the other comparison operators.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
The bug: a DECIMAL property holding 5 did not match = 5.0 in a query, even though >= and <= correctly did. = now agrees with the ordering operators for every numeric comparison.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
Activity
Merge pull request #7627 from ArcadeData/fix/issue-7623-7614-7613-758…
lvca commentedon Sep 16, 2026
Fixed: a
DECIMALproperty could fail to match a numerically-equal literal of a different scale (e.g. a stored5did not equal5.0in an equality check, even though>=/<=worked correctly). Decimal values are now aligned to the same scale before comparing, so equality now agrees with the other comparison operators.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#7623,ArcadeData#7614,ArcadeData#7613,ArcadeData#7581):…
lvca commentedon Sep 16, 2026
Fixed in #7627 (merged into main).
The bug: a
DECIMALproperty holding5did not match= 5.0in a query, even though>=and<=correctly did.=now agrees with the ordering operators for every numeric comparison.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
Fix a batch of five audit findings (ArcadeData#7465 ArcadeData#7767 A…