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

to_date UDF cannot accept NULLs of VOID type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.0.0
    • 1.3.0, 2.1.0
    • UDF
    • None

    Description

      The to_date method behaves differently based off the 'data type' of null passed in.

      hive> select to_date(null);
      FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments 'TOK_NULL': TO_DATE() only takes STRING/TIMESTAMP/DATEWRITABLE types, got VOID

      hive> select to_date(cast(null as timestamp));
      OK
      NULL
      Time taken: 0.031 seconds, Fetched: 1 row(s)

      This appears to be a regression introduced in HIVE-5731. The previous version of to_date would not check the type:

      https://github.com/apache/hive/commit/09b6553214d6db5ec7049b88bbe8ff640a7fef72#diff-204f5588c0767cf372a5ca7e3fb964afL56

      Attachments

        1. HIVE-12502.1.patch
          3 kB
          Jason Dere
        2. HIVE-12502.patch
          3 kB
          Aaron Tokhy
        3. HIVE-12502-branch-1.patch
          3 kB
          Aaron Tokhy

        Issue Links

          Activity

            People

              aartokhy Aaron Tokhy
              aartokhy Aaron Tokhy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: