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

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.15.0
    • 1.17.0
    • Functions - Drill
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: