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

Extend $analyzeInternal to create histograms

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      Have $_analyzeInternal route inputs to the appropriate histogram builder based on the input. There are four histogram builders – Scalar, ArrMin, ArrMax, and ArrUnique.

      If the input is not one of the histogrammed types, per the scope document, increment the count in either the array or non-array

      If isArray is false, route to Scalar

      If isArray is true, do the following:

      { If this is the first time we've seen this document ID, route to ArrMin and ArrUnique,  and store the value in a hash table with the document ID as key. Else If the types of the stored and new value for the document ID don't match, then sort all stored values, route them to ArrMax, and clear the hash table. Route the new value to ArrMin and ArrUnique and store the new value. Else If the values of the stored and new values don't match, then replace the stored value with the new value, and route the new value to ArrUnique. If the new and stored values match, we ignore the value. }

      Once we're finished processing, sort all the stored values, then route them to ArrMax.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            joel.redman@mongodb.com Joel Redman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: