$unionWith serialization in allPlansExecution explain execution does not reflect timeseries view resolution

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • ALL
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In https://jira.mongodb.org/browse/BF-44202 , a pipeline on a timeseries collection containing $unionWith was found to error out during explain execution.

      The example query is:

      const aggregationList = [    [{"$sort": {"_id": 1}}, {"$bucket": {"groupBy": {"$rtrim": {"input": {"$toLower": "with royal petticoat"}, "chars": {"$toLower": "bug"}}}, "boundaries": ["excluding institute daddy", "yippee", "zesty"], "default": 71204, "output": {"obj": {"$first": {"$dateToParts": {"date": new Date("2019-07-16T12:00:40.434Z"), "timezone": "Australia/Lord_Howe"}}}, "array": {"$maxN": {"n": 12, "input": {"$setDifference": [[true, "$count"], ["$_id", "$obj.obj.obj.date"]]}}}}}}, {"$sort": {"_id": 1}}, {"$limit": 10}, {"$unionWith": {"coll": "fuzzer_coll", "pipeline": [{"$sort": {"_id": 1}}, {"$sortByCount":  "$_id"}]}}], // 150]; 

       

      The fuzzer tries to run this query via explain, because the results diverge between optimized/non-optimized. This divergence is caused by one plan choosing to execute via SBE vs. classic. It is a known divergence, but it is not caught because the explain query fails to execute in either engine.

      The error we see is :

      "error":"Location7158200: $toUpper input type is not supported 

      Currently, when serialize $unionWith in allPlansExecution, we use the _userPipeline which would not reflect the view resolution. This means that when we run explain for the pipeline, the buckets unpacking does not happen. 

            Assignee:
            Unassigned
            Reporter:
            Santiago Roche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: