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

Support limit expression for $filter in SBE

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

      This invariant is firing in the visit overload for ExpressionFilter during translation of a $filter during work in SERVER-32739.

      https://github.com/10gen/mongo/blob/master/src/mongo/db/query/sbe_stage_builder_expression.cpp#L522

      A possible explanation for this is that the expression walker will make the following calls since $filter has multiple children,

      preVisit(), inVisit(), inVisit(), postVisit.

      On the first inVisit() call we pull the variableId from the ExpressionFilter instance that we are translating, and stick it in _context->environment. Then on the second inVisit call we pull the same variableId from the ExpressionFilter instance and since we have already inserted the variableId into the environment, we trip the invariant.

      This work should support translation of a limit expression in $filter.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            eric.cox@mongodb.com Eric Cox (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: