Operational Defect Database

BugZero found this defect 101 days ago.

MongoDB | 2571152

SBE and Classic behave differently for $bitsAnyClear on NumberDecimal infinity

Last update date:

3/11/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

8.0.0-rc0

Description:

Info

Minimal example: (function() { db.c.insert({_id: 1, num: NumberDecimal("infinity")}); const pipe = [{$match: {"num": {$bitsAnyClear: 11111000}}}]; let explain = db.c.explain().aggregate(pipe); if (explain.queryPlanner.winningPlan.slotBasedPlan) { print("EXPLAIN: \n" + explain.queryPlanner.winningPlan.slotBasedPlan.stages); } print("RESULTS: " + tojson(db.c.aggregate(pipe).toArray())); })(); This pipeline gives different results between SBE and classic. Classic returns the document, while SBE does not. According to our documentation, $bitsAnyClear will not match values which can't be represented in a 64 bit integer (See "floating point" section of the page). SBE's behavior matches the documentation (hence I'm not marking this as a "bug" ticket). There is a note in some of the SBE stage builder code that we try to match classic's behavior despite the documentation (see here).

Top User Comments

xgen-internal-githook commented on Fri, 8 Mar 2024 00:38:51 +0000: Author: {'name': 'kmznam', 'email': '97981975+kmznam@users.noreply.github.com', 'username': 'kmznam'} Message: SERVER-86419 Fix $bitsAnyClear behavior around invalid NumberDecimal values to match documentation (#19659) GitOrigin-RevId: 66bca46dea498f2b538913b61c33c97a84cfde9e Branch: master https://github.com/mongodb/mongo/commit/0c3940afb9c471d9b505ac643835b8e4c2cafe1f JIRAUSER1257467 commented on Mon, 12 Feb 2024 13:26:35 +0000: ian.boros@mongodb.com Moving to open since this was assigned to you , if this is incorrect please send it back to the Triage queue ian.boros commented on Fri, 9 Feb 2024 15:34:24 +0000: I've spoken with product, and they've agreed this should be considered a bug in the classic engine.

Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Closed

Learn More

Search:

...