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

unix_timestamp(string date, string pattern) UDF does not verify date is valid

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: UDF
    • Labels:

      Description

      unix_timestamp(string date, string pattern) returns a value in situations which would be expected to return 0 (fail):

      hive> -- Date does not exist
          > select unix_timestamp('2017/02/29', 'yyyy/MM/dd');
      OK
      1488326400
      Time taken: 0.317 seconds, Fetched: 1 row(s)
      hive> -- Date does not exist
          > select from_unixtime(unix_timestamp('2017/02/29', 'yyyy/MM/dd'));
      OK
      2017-03-01 00:00:00
      Time taken: 0.28 seconds, Fetched: 1 row(s)
      hive> -- Date in wrong format
          > select unix_timestamp('2017/02/29', 'MM/dd/yyyy');
      OK
      -55950393600
      Time taken: 0.303 seconds, Fetched: 1 row(s)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bgoerlitz Brian Goerlitz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: