Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-7139

Date_add() can produce incorrect results when adding to a timestamp

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.15.0
    • Fix Version/s: 1.17.0
    • Component/s: Functions - Drill
    • Labels:
      None

      Description

      I am using date_add() to create a sequence of timestamps:

      select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107374,'M') as interval minute)) timestamp_id from (values(1));
      +--------------------------+
      |       timestamp_id       |
      +--------------------------+
      | 1970-01-25 20:31:12.704  |
      +--------------------------+
      1 row selected (0.121 seconds)
      

      When I add one more, I get an older timestamp:

      select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107375,'M') as interval minute)) timestamp_id from (values(1));
      +--------------------------+
      |       timestamp_id       |
      +--------------------------+
      | 1969-12-07 03:29:25.408  |
      +--------------------------+
      1 row selected (0.126 seconds)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dgrinchenko Dmytriy Grinchenko
                Reporter:
                rhou Robert Hou
                Reviewer:
                Igor Guzenko
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: