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

Improve UnpackBucketNode stage builder so that it does not generate duplicated meta slot when bucket-level filter has dependency on the meta field

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • QI 2023-10-02

      > db.ts.aggregate([{$match: {tag: "a"}}, {$project: {f: 1, time: 1, tag: 1}}], {collation: {locale: "en", strength: 1}});
      [2] mkbson s13 [_id = s10, f = s11, time = s12, tag = s6] true false
      [2] block_to_row blocks[s7, s8, s9] vals[s10, s11, s12]
      [2] ts_bucket_to_cellblock s2 paths[s7  =  _id, s8  =  f, s9  =  time] meta =  s6
      [1] filter {traverseF(s1, lambda(l1.0) { ((l1.0 ==[s5] s4) ?: false) }, false)}
      [1] scan s2 s3 none none none none none none lowPriority [s1 = meta] @"2238077b-8893-4b6c-bbb4-21b5f72c55de" true false
      

      Note that in the above example, both s1 and s6 holds the 'meta' field.

      > db.ts.aggregate([{$match: {tag: {$in: ["a", "c"]}}}, {$project: {f: 1, time: 1, tt: {$concat: ["$tag", "-", "abc"]}, ss: {$concat: ["$tag", "XYZ"]}}}], {collation: {locale: "en", strength: 1}});
      [3] mkbson s15 [_id = s12, f = s13, time = s14, ss = s7, tt = s8] true false
      [3] block_to_row blocks[s9, s10, s11] vals[s12, s13, s14]
      [3] ts_bucket_to_cellblock s6 paths[s9  =  _id, s10  =  f, s11  =  time]
      [2] project [s7 = getField(s6, "ss"), s8 = getField(s6, "tt")]
      [2] project [s6 = makeBsonObj(MakeObjSpec(drop, [], ["tt", "ss"]), s2,
          if (typeMatch(s1, 1088ll) ?: true)
          then null
          else
              if isString(s1)
              then concat(s1, "-abc")
              else fail(7158201, "$concat supports only strings")
      ,
          if (typeMatch(s1, 1088ll) ?: true)
          then null
          else
              if isString(s1)
              then concat(s1, "XYZ")
              else fail(7158201, "$concat supports only strings")
      )]
      [1] filter {traverseF(s1, lambda(l1.0) { isMember(l1.0, s4) }, false)}
      [1] scan s2 s3 none none none none none none lowPriority [s1 = meta] @"2238077b-8893-4b6c-bbb4-21b5f72c55de" true false
      

      Also we should be able to avoid materialize the temporary BSON object for the computed meta fields.

            Assignee:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Reporter:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: