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

$setWindowFields aggregate commands generate unstable hashes

    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0
    • QE 2024-04-29

      Repeatedly setting query settings on aggregate([\{$setWindowFields: ...}]) queries generates multiple query shape configurations due to diverging query shape hashes.

      Enterprise rs0 [direct: primary] test> db.adminCommand({ setQuerySettings: { aggregate: "test", pipeline: [{ $setWindowFields: { partitionBy: { int_field: "$int_field", other_field: "$other_field" }, output: { count: { $sum: 1 } } } }, { $project: { _id: 0 } }], $db: "test" }, settings: { indexHints: { ns: { db: "test", coll: "test" }, allowedIndexes: ["a_1"] } } })
      {
        queryShapeHash: '5902836CF946238C384741B17CFF8EC94698DC3FE049ADC70B252AF81954347E',
        settings: {
          indexHints: { ns: { db: 'test', coll: 'test' }, allowedIndexes: [ 'a_1' ] }
        },
        representativeQuery: {
          aggregate: 'test',
          pipeline: [
            {
              '$setWindowFields': {
                partitionBy: { int_field: '$int_field', other_field: '$other_field' },
                output: { count: { '$sum': 1 } }
              }
            },
            { '$project': { _id: 0 } }
          ],
          '$db': 'test'
        },
        ok: 1,
        '$clusterTime': {
          clusterTime: Timestamp({ t: 1712852882, i: 2 }),
          signature: {
            hash: Binary.createFromBase64("AAAAAAAAAAAAAAAAAAAAAAAAAAA=", 0),
            keyId: Long("0")
          }
        },
        operationTime: Timestamp({ t: 1712852882, i: 2 })
      }
      Enterprise rs0 [direct: primary] test> db.adminCommand({ setQuerySettings: { aggregate: "test", pipeline: [{ $setWindowFields: { partitionBy: { int_field: "$int_field", other_field: "$other_field" }, output: { count: { $sum: 1 } } } }, { $project: { _id: 0 } }], $db: "test" }, settings: { indexHints: { ns: { db: "test", coll: "test" }, allowedIndexes: ["a_1"] } } })
      {
        queryShapeHash: '247818291A399B424BCF04722ABC42CB9109C7EEF6B02A7F796BE3D255DDDBB7',
        settings: {
          indexHints: { ns: { db: 'test', coll: 'test' }, allowedIndexes: [ 'a_1' ] }
        },
        representativeQuery: {
          aggregate: 'test',
          pipeline: [
            {
              '$setWindowFields': {
                partitionBy: { int_field: '$int_field', other_field: '$other_field' },
                output: { count: { '$sum': 1 } }
              }
            },
            { '$project': { _id: 0 } }
          ],
          '$db': 'test'
        },
        ok: 1,
        '$clusterTime': {
          clusterTime: Timestamp({ t: 1712852884, i: 1 }),
          signature: {
            hash: Binary.createFromBase64("AAAAAAAAAAAAAAAAAAAAAAAAAAA=", 0),
            keyId: Long("0")
          }
        },
        operationTime: Timestamp({ t: 1712852884, i: 1 })
      } 

            Assignee:
            serhii.lysenko@mongodb.com Serhii Lysenko
            Reporter:
            catalin.sumanaru@mongodb.com Catalin Sumanaru
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: