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

Inconsistent handling of out-of-range values in integer casts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • Impala 2.3.0
    • None
    • Backend

    Description

      John Russell discovered some odd behaviour in casttoint. In some cases it returns NULL when the input is an out-of-range value. In others it returns the overflowed value.

      [tarmstrong-box.ca.cloudera.com:21000] > select casttoint(hex('1F603'));
      Query: select casttoint(hex('1F603'))
      +-------------------------+
      | casttoint(hex('1f603')) |
      +-------------------------+
      | NULL                    |
      +-------------------------+
      Fetched 1 row(s) in 0.01s
      [tarmstrong-box.ca.cloudera.com:21000] > select hex('1F603');
      Query: select hex('1F603')
      +--------------+
      | hex('1f603') |
      +--------------+
      | 3146363033   |
      +--------------+
      Fetched 1 row(s) in 0.01s
      [tarmstrong-box.ca.cloudera.com:21000] > select casttoint(3146363033);
      Query: select casttoint(3146363033)
      +-----------------------+
      | casttoint(3146363033) |
      +-----------------------+
      | -1148604263           |
      +-----------------------+
      Fetched 1 row(s) in 0.01s
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tarmstrong Tim Armstrong
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: