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

Impala returns wrong result for function 'conv(bigint, from_base, to_base)'

    Details

      Description

      Impala returns wrong result for function 'conv'. Please see below command as example:

      [10.17.80.14:21000] > select 2061013007, conv(2061013007, 16, 10), conv('2061013007', 16, 10) ;
      Query: select 2061013007, conv(2061013007, 16, 10), conv('2061013007', 16, 10)
      +------------+--------------------------+----------------------------+
      | 2061013007 | conv(2061013007, 16, 10) | conv('2061013007', 16, 10) |
      +------------+--------------------------+----------------------------+
      | 2061013007 | 1627467783               | 139066421255               |
      +------------+--------------------------+----------------------------+
      Fetched 1 row(s) in 0.65s
      [10.17.80.14:21000] > select 2061013007, conv(cast(2061013007 as bigint), 16, 10), conv('2061013007', 16, 10) ;
      Query: select 2061013007, conv(cast(2061013007 as bigint), 16, 10), conv('2061013007', 16, 10)
      +------------+------------------------------------------+----------------------------+
      | 2061013007 | conv(cast(2061013007 as bigint), 16, 10) | conv('2061013007', 16, 10) |
      +------------+------------------------------------------+----------------------------+
      | 2061013007 | 1627467783 | 139066421255 |
      +------------+------------------------------------------+----------------------------+
      Fetched 1 row(s) in 0.03s
      [10.17.80.14:21000] > select 2061013007, conv(cast(2061013007 as string), 16, 10), conv('2061013007', 16, 10) ;
      Query: select 2061013007, conv(cast(2061013007 as string), 16, 10), conv('2061013007', 16, 10)
      +------------+------------------------------------------+----------------------------+
      | 2061013007 | conv(cast(2061013007 as string), 16, 10) | conv('2061013007', 16, 10) |
      +------------+------------------------------------------+----------------------------+
      | 2061013007 | 139066421255                             | 139066421255               |
      +------------+------------------------------------------+----------------------------+
      Fetched 1 row(s) in 0.02s
      [10.17.80.14:21000] > select 2061013007, conv(cast(cast(2061013007 as decimal(20,0)) as bigint), 16, 10), conv('2061013007', 16, 10) ;
      Query: select 2061013007, conv(cast(cast(2061013007 as decimal(20,0)) as bigint), 16, 10), conv('2061013007', 16, 10)
      +------------+-----------------------------------------------------------------+----------------------------+
      | 2061013007 | conv(cast(cast(2061013007 as decimal(20,0)) as bigint), 16, 10) | conv('2061013007', 16, 10) |
      +------------+-----------------------------------------------------------------+----------------------------+
      | 2061013007 | 1627467783                                                      | 139066421255               |
      +------------+-----------------------------------------------------------------+----------------------------+
      Fetched 1 row(s) in 0.03s
      

      Function conv(bigint, from_base, to_base) doesn't return correct result, while conv(string, from_base, to_base) returns correct value.

      This happens in CDH5.5 as well.

      Workaround
      Cast value to string and use conv(string, from_base, to_base) for conversion.

        Attachments

          Activity

            People

            • Assignee:
              mala_ck Mala Chikka Kempanna
              Reporter:
              Yibing Yibing Shi
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: