Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-15

UNIX_TIMESTAMP format behaviour deviates from Hive when format matches a prefix of the time value

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 0.3
    • None
    • None
    • None

    Description

      Impala's UNIX_TIMESTAMP(val, format) operation compares the length of format and val and returns NULL if they do not match. Hive instead effectively truncates val to format's length.

      For example, in Hive:

      hive> select UNIX_TIMESTAMP('2000-02-01 10:20:30','yyyy-MM') FROM tmp;
      <snip>
      OK
      949392000
      
      hive> select UNIX_TIMESTAMP('2000-02-01 10:20:30','yyyy') FROM tmp;
      <snip>
      OK
      946713600 <<< Note that value has changed since the format truncated the string to just '2000'
      
      hive> select UNIX_TIMESTAMP('2000-02-01 10:20:30 junk text','yyyy') FROM tmp;
      <snip>
      OK
      946713600 <<< Still works! Garbage string is ignored.
      

      Attachments

        Activity

          People

            skye Skye Wanderman-Milne
            henryr Henry Robinson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: