Expression::optimize() is used incorrectly when trying to convert $group to streaming for time-series

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • Fully Compatible
    • QE 2023-08-07
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This line of code incorrectly discards the return value. It's written like so:

      idFields[i]->optimize();  // We optimize here to make use of constant folding.
      

      But it should be this:

      idFields[i] = idFields[i]->optimize();  // We optimize here to make use of constant folding.
      

      The reason is that the Expression::optimize() function does not optimize the expression in place but rather returns a pointer to the optimized expression.

      While we're at it, we should consider adding the "[[nodiscard]]" attribute to Expression::optimize() in order to try to prevent this kind of mistake in the future.

            Assignee:
            Foteini Alvanaki
            Reporter:
            David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: