Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-97800

Histogram estimates for {a: null} ignores documents with missing fields

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: Query Planning
    • None
    • Query Optimization
    • Fully Compatible
    • ALL

      Values that are missing from a document are not reflected in the histograms. So the estimate of predicates such as {{

      {a:null}

      }} reflects only the documents where a is explicitly null but not documents where a is missing altogether. Both type of rows match this predicate, so the estimate should reflect the sum of both.

      Cause

      In histogram generation, documents missing the field increments the counts for TypeTags::Nothing rather than TypeTags::Null.

      In histogram estimation, interval like [null, null] only consults the counts for TypeTags::Null.

      Plan of Attack

      In type counts estimation, if an interval is [null, null], adds the counts from both Null and Nothing.

            Assignee:
            chii.huang@mongodb.com Chi-I Huang
            Reporter:
            chii.huang@mongodb.com Chi-I Huang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: