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

Fix case of Month token in datetime to string conversion

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1
    • None
    • None

    Description

      Currently Hive doesn't allow month tokens with weird spelling like 'MONth', 'mONTH' etc. However, Oracle does and Hive should follow that approach.

      The rules:

      • If the first letter is lowercase then the output is lowercase: 'mONTH' -> 'may'
      • If the first two letters are uppercase then the output is uppercase: 'MOnth' -> 'MAY'
      • If the first letter is uppercase and the second is lowercase then the output is capitalized: 'Month' -> 'May'.

      Oracle:

      select to_char(to_timestamp('2019-05-10', 'YYYY-MM-DD'), 'MOnthYYYY') from DUAL;
      MAY      2019
      
      select to_char(to_timestamp('2019-05-10', 'YYYY-MM-DD'), 'mONTHYYYY') from DUAL;
      may      2019
      
      select to_char(to_timestamp('2019-05-10', 'YYYY-MM-DD'), 'MoNTHYYYY') from DUAL;
      May      2019
      

      Please check the same for 'Name of the day' tokens.

      Attachments

        1. HIVE-22511.01.patch
          5 kB
          Karen Coppage

        Activity

          People

            klcopp Karen Coppage
            gaborkaszab Gabor Kaszab
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: