Investigate changes in SERVER-110620: dateAdd(date, 0) does not return the original input for some dates

XMLWordPrintableJSON

    • Type: Investigation
    • Resolution: Won't Do
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Tools and Replicator

      Original Downstream Change Summary

      This change will result in dates before epoch (01-01-1970) with millisecond precision , when used in $dateAdd, $dateSubtract, $setWindowFields, and $densify, being one second greater.

      Description of Linked Ticket

      The dateAdd() function defined in date_time_support does not always return the original date when it is given the value 0 to add. This affects results of the $dateAdd expression and can cause $setWindowFields failures due to bounds being computed incorrectly using the dateAdd helper function when a window function has bounds [0,0].

      Original ticket description:

      See discussion here and in the other comments on the ticket.

      When running a $setWindowFields (regardless of window function), with a range-based upper bound of 0, we exclude the current document. We should be including it. When running a $setWindowFields with a range-based upper bound of "current", we correctly include the current document.

      I have attached a js test file that can be used to reproduce this.

      After fixing this bug, we should also add tests to jstests/aggregation/sources/setWindowFields/min_max_scaler_parsing.js for range-based boundaries with 0 and "current" as the upper bound.

            Assignee:
            Unassigned
            Reporter:
            Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: