Hive
  1. Hive
  2. HIVE-4174

Round UDF converts BigInts to double

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.11.0
    • Component/s: UDF
    • Labels:
      None
    • Hadoop Flags:
      Incompatible change, Reviewed
    • Release Note:
      The change makes the return type of round function be the same type as that of the first argument (assuming that it is integer, double, or decimal). This means that for an integer argument, the result is an integer (no decimal places).

      Description

      Chen Chun pointed out on the hive-user mailing list that round() in Hive 0.10 returns

      select round(cast(1234560 as BIGINT)), round(cast(12345670 as BIGINT)) from test limit 1;
      
      //hive 0.10
      1234560.0  1.234567E7
      

      This is not consistent with MySQL(http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_round)

      which quotes

      The return type is the same type as that of the first argument (assuming that it is integer, double, or decimal). This means that for an integer argument, the result is an integer (no decimal places)
      
      1. HIVE-4174.1.patch.txt
        7 kB
        Chun Chen
      2. HIVE-4174.D9687.1.patch
        7 kB
        Phabricator
      3. hive.4174.1.patch-nohcat
        14 kB
        Namit Jain

        Issue Links

          Activity

          Mark Grover created issue -
          Mark Grover made changes -
          Field Original Value New Value
          Link This issue is related to HIVE-3675 [ HIVE-3675 ]
          Chun Chen made changes -
          Attachment HIVE-4174.1.patch.txt [ 12574073 ]
          Chun Chen made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Hadoop Flags Incompatible change [ 10342 ]
          Release Note The change makes the return type of round function be the same type as that of the first argument (assuming that it is integer, double, or decimal). This means that for an integer argument, the result is an integer (no decimal places).
          Phabricator made changes -
          Attachment HIVE-4174.D9687.1.patch [ 12575332 ]
          Namit Jain made changes -
          Attachment hive.4174.1.patch-nohcat [ 12576732 ]
          Namit Jain made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags Incompatible change [ 10342 ] Incompatible change,Reviewed [ 10342, 10343 ]
          Resolution Fixed [ 1 ]
          Ashutosh Chauhan made changes -
          Assignee Mark Grover [ mgrover ] Chen Chun [ chenchun ]
          Owen O'Malley made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Chun Chen
              Reporter:
              Mark Grover
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development