Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-28117

add_months() with output_date_format returning wrong year on leap day

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.1.3
    • None
    • Hive
    • None

    Description

      I use an output_date_format option on the add_months() function like so:

      select add_months(dt, -2, 'YYYY-MM')

      On leap day, 2024-02-29, this incorrectly returned 2024-12.  I expected 2023-12.  All other days it works fine, only leap day it gave the wrong result.

       

      Omitting the output date format will make it calculate the date correctly.  Including the output date format gives the wrong result.

      Attachments

        1. 2024-03-11_12-11-11.png
          45 kB
          Jesse Petre

        Activity

          People

            Unassigned Unassigned
            jpetre Jesse Petre
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: