[SERVER-68274] [SBE] Missing query results when comparing field to Min/MaxKey and field is missing from document Created: 25/Jul/22  Updated: 05/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Ben Shteinfeld Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: mql-semantics, sbe
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Operating System: ALL
Sprint: QE 2022-09-19
Participants:

 Description   

Consider the following example running the classic engine:

> db.c.insert({b: 1})
> db.c.find({a: {$gt: MinKey()}})
{b: 1}

Because the `a` field is missing in the document, it is implicitly `null` for the purposes of evaluating `a > MinKey()`. Because of BSON ordering semantics, `null` is greater than `MinKey()`, and results in the document being matched.

When SBE (featureFlagSbeFull) is enabled, the server incorrectly omits this document.



 Comments   
Comment by Kyle Suarez [ 29/Sep/22 ]

I spoke to christopher.harris@mongodb.com about this today:

  • In most cases, we don't really care about MinKey being used in queries. That being said, some TSEs make a recommendation to customers to "compare field x to MinKey" to force the use of a particular index, so it's not like there's zero risk here.
  • Ultimately, neither of us feel the need to action on this now unless the answer to this (either changing classic to match SBE or the other way around) somehow blocks a major architectural decision in either SBE, Bonsai or the broader CQF effort.

Based on the decision to not prioritize this ticket; I'm sending it back to the backlog, but marking it with the mql-semantics label to start tracking these "weird MQL behavior" tickets in one place.

Generated at Thu Feb 08 06:10:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.